JohnCoene / javascript-for-r

📚 JavaScript for R CRC Book
https://javascript-for-r.com/
Other
181 stars 46 forks source link

Question regarding use of cookies #9

Open markusdumke opened 3 years ago

markusdumke commented 3 years ago

Thank you very much for this interesting example on using cookies in a shiny app (Chapter 16). I have noticed that the uiOutput is actually created twice if there is a cookie in the browser (easily observed with a print statement inside renderUI). This leads to a poor user experience if the UI is created twice (e.g. once for a not logged-in user and then again if the cookie event is fired), especially if some parts need longer computations.

So, my question is, do you know of any way to get the cookie first, before triggering any observers and outputs in shiny? This would be really useful for the applications I am building, where different parts of UI should be visible depending on who is logged in (if any).

JohnCoene commented 3 years ago

Hi Markus,

Apologies for the late response; I'll take a look at this as soon as I find the time.