-
Notifications
You must be signed in to change notification settings - Fork 30
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
observeEvent triggered as many times as page_change #71
Comments
@andbamp This is the behavior that happens when you use observers inside of the page. This is because shiny doesn't destroy observers when the server code is called for the n-th time but registers them again (please check my blogpost that describes the issue: https://appsilon.com/how-to-safely-remove-a-dynamic-shiny-module/). Unfortunately in shiny.router, the main functionality is based on rerendering the page server code. We've got a few ideas how to implement this properly but this is of a low priority now, but I'll let you know when it's done. In the meantime, you may try to force destroying observers (following instructions from the above blogpost, my solution in #69 might also help) everytime the page is switched. Please let me know if you need any help with it. |
@andbamp I decided to give my idea a try, and the issue should be fixed now. Please install the package from https://github.com/Appsilon/shiny.router/tree/krystian.stop-rerendering-whole-page branch and let me know if everything works correctly now. |
I didn't realise shiny.router's functionality was based on rerunning the server code. This fix not only solves the issue of console output being printed multiple times (and cases such as dialogs instantiated by shinyjs appearing multiple times), but it also negates the need to set I tested the new branch in a few scenarios and it seems to work well, but one side-effect I noticed is that the UI elements defined in
Thanks for addressing the issue so fast @krystian8207! Being able to use shiny.router without modifications to the main application code (be it |
@andbamp Thank you for noticing that. The current branch version should fix this behavior as well. |
Hello, thanks for your useful package!
I have run into an issue when it comes to changing pages. Here is a minimal example:
Expected behaviour:
Actual behaviour:
This seems to be related to issue #67. Any feedback is appreciated!
The text was updated successfully, but these errors were encountered: