-
Notifications
You must be signed in to change notification settings - Fork 21
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
Shiny server function is called twice when browser is Firefox #77
Comments
Hi! I was able to reproduce the issue! Mindblowing! I don't know a workaround yet, maybe we should discover in Auth0 or Shiny documentation why that happens |
We were able to reproduce the issue without calling What What we did was add the redirect directly in this minimal example, and the problem for chrome/firefox persists. # shinyapp
library(shiny)
ui <- function(req) {
cat("Entered `ui` function\n")
redirect <- sprintf("location.replace(\"%s\");", "https://www.google.com")
shiny::tags$script(redirect)
}
server <- function(input, output, session) {
cat('Entered `server` function\n')
session$onSessionEnded(function() {
cat('Session ended\n')
})
}
options(shiny.port = 8080)
shiny::shinyApp(ui, server)
Then, what we need is to replace this |
Can someone give some insight into what calls the |
I don't know how to fix this issue but for anyone else who needs a patch; I used the following to ensure the functionality continued:
Edit: actually I realised later that this is not enough; this will mean |
I'm using Auth0 from a Shiny app. When the app runs in Chrome, the server function is called once, after the user logs in, with
session$userData
populated with theauth0_credentials
andauth0_info
. This is good 😺When the app runs in Firefox, the server function is called twice - once immediately, with no
session$userData
, and again after the user logs in, withsession$userData
populated. If asession$onSessionEnded
callback has been registered, it is called after the first call toserver
.This is bad for a couple of reasons:
session$onSessionEnded
is used conventionally to register a call tostopApp
, the application exits before the second call toserver
. This is catastrophic, the application does not launch.server
will fail if theserver
function tries to access anything insession$userData
. This is merely annoying since the function is called again.Here is a minimal reprex (you must supply your own
_auth0.yml
and.Renviron
files):When I run this on Chrome, the output is
with no output appearing until after I log in.
When I run on Firefox, the output is
where the first three lines are output before I complete the login sequence.
What is causing the double call to
server
and how can I prevent it?Thanks!
The text was updated successfully, but these errors were encountered: