-
-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tracking and then updating a signal in on_cleanup causes Router to rerender #1882
Comments
Uhhh interesting. So I guess it would be possible to internally untrack before running cleanups. This just adds an overhead to every Just so I'm clear: is there a use case in which you actually want something tracked in a cleanup function, or was it tracked accidentally? |
This was tracked accidentally due to #1880. Probably it would be sufficient if there was some kind of diagnostic in debug mode for this case. |
Sounds like a good idea. |
For the sake of clarity, I checked and it doesn't rerender the It was also easy and very cheap (a single |
Ah, that's very nice. Thanks a lot! <3 |
Describe the bug
When using a tracked signal in on_cleanup of a page component, and then updating it from within that component for example via
request_animation_frame
orset_timeout
then once navigation switches to a different page, the Router renders the new page twice.Leptos Dependencies
To Reproduce
Use the code below, go to the HomePage (default), then click on "Random" to switch to the other page. In the console, there will be these log messages:
Expected behavior
Ideally, the code in
on_cleanup
should only be using untracked functions I guess, but this bug is very difficult to track down. I don't know why this tracking causes the Router to end up rerendering the page. It shouldn't, I think.The text was updated successfully, but these errors were encountered: