Doubts in app developent

Hello,

I am new to Shiny and I have a problem developing an application in Shiny.
Each user who runs the application needs to obtain certain parameters that are different for each user.
These parameters must be obtained initially before performing any other operation in the APP since they determine for example the connection to the DDBB.
I have seen that in the server.R the code is executed first and later the observe() declared and this is an inconvenience because the parameters are passed through the URL and
to obtain them using parseQueryString you need an observe().
To clarify, the flow would be as follows:

1 - get the user parameters from the URL
2 - obtain the data from the DDBB with the parameters obtained in step 1

Shiny would first execute step 2 and then 1.
Can someone tell me if there is any way I can change the order?
Maybe I should use another approach to the problem? get the parameters differently?

Thank you very much for your help.

Greetings.

I think you can actually skip the observe and access the query as follows:
parseQueryString(isolate(session$clientData$url_search))

I was able to replicate this https://shiny.rstudio.com/articles/client-data.html locally. Normally isolate prevents an observe(Event) from triggering, but it has a nice extra property to allow you to read reactive values outside of a reactive context.

Michael, you saved my life!!!

Thank you very much for your help.

1 Like