-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
The input$id variable of the navBar does not take into account the inserted panels (insertTab) #3806
Comments
@cpsievert I think the problem could be related to bslib considering that the navBar methods were migrated to bslib |
Hello, I tested deploying this same app to shinyapps.io and the behavior is similar. In this case to see the problem it is only necessary:
On the other hand, the problem does not only happen with the input$id of the navBar:
Regards, |
Hello, I think the problem is bigger than the input$id. For example, if I insert a navs_tab_card inside one of the navs inserted through nav_insert I see that the html is different. In the following image the html of the initial app on the left and on the right the html of the app after going to another page and coming back. Regards, |
Hi @apalacio9502 and thanks for the bug report and for including a reprex. We were able to reproduce the issue you described. We've tracked the root issue down to the interaction of two things:
There aren't easy user-facing workarounds. We need the global Shiny option @schloerke and I explored a few options and we determined that Shiny could globally set Another option might be to serialize the |
Hello @gadenbuie, Thank you for your response!!! I have been testing the version 596165e and the problem is resolved. However, I would like to know if there is any way to implement the same solution with the production version of Shiny temporarily. Or if it is possible to make the same configuration to Posit Connect through https://rsc.radixu.com/__docs__/admin/appendix/configuration/#Server.CustomHeader. This problem is becoming very relevant in our case and we believe it is risky to install a development version that has significant changes according to the news. Regards, |
@apalacio9502 I tried adding a
Note that this only prevents the cached version from being used in the case of the forward/back button being used, but that's also the only way I could get Chrome to use the cached version. |
Hi @apalacio9502. Unfortunately, I don't know of an easy way to do this without the kind of modification we're proposing in #3810 or another method that we would have to set up. (Joe added an example as I was writing this.) Here are two ideas that might help:
|
Come to think of it, adding |
Hello @jcheng5, Thank you for your response!!! Yesterday, in my attempts to solve the problem, I tried disabling the cache by inserting a meta tag as you mentioned, but it didn't work for me either. I also did tests with a similar method to the one you propose (https://stackoverflow.com/questions/43043113/how-to-force-reloading-a-page-when-using-browser-back-button), however, the behavior the user sees is strange!!!! First, the UI is rendered in cache and then the page is reloaded. Regards, |
Thank you @jcheng5 This solution works correctly based on the tests we carried out, however I have two questions:
On the other hand, this solution would replace the change that @gadenbuie and @schloerke proposed or would be a provisional solution? |
Because of this, I think you should do something like this (and this should answer your second question):
I think the change that Garrick and Barret are proposing should make this workaround unnecessary, and is generally a good change anyway. |
@gadenbuie Makes me wonder if |
If a |
@jcheng5 that's certainly possible, although not my favorite as a default. I wonder if we could have bslib's global theme functions call I'd have to learn more about bslib's global theme infrastructure, but that might be a holistic approach. For example, I think people might be surprised to find that bs_global_theme(version = 5, bootswatch = "minty")
page_navbar(title = "My Page") doesn't produce a page with the minty theme unless you explicitly use the global theme page_navbar(title = "My Page", theme = bs_global_get()) Either case, though, would require the user to know that they need to set the theme globally outside of the UI function, which might be hard to realize given the client-side symptoms (as in this issue).
@schloerke All the bslib |
Hello,
Currently, if you have a navBarPage or a page_navbar and you do an insertTab or insert_nav in the following situation, the navbar's input$id variable does not take into account inserted panels.
I couldn't find a way to explain the problem without using a video.
The error was caught when the app is deployed to Posit Connect. As seen in the video at 1 second, I have a navBar which has three navs (Nav 0 is inserted into ui at initialization and the others via nav_insert) and when one of the navs is clicked it throws an alert with the name of the active nav. This was done by looking at the input$id of the navbar which in this case is called input$test and sending a message to js via session$sendCustomMessage.
At 11 seconds I go to another web page and return to the app with the browser arrows before Posit Connect kills the process. When I go back to the app I see that clicking on all the navs returns the name.
The problem: At 21 seconds I go to another web page and wait for Posit Connect to finish the process. In the second 47 I return to the application with the arrows of the browser. When I go back to the app I see that clicking on nav 1 and nav 2 does not return the name.
Test.Insert.Navs.mp4
Here is the application code:
Next I leave the information of the computer from where the application was deployed.
Regards,
The text was updated successfully, but these errors were encountered: