firebase icon indicating copy to clipboard operation
firebase copied to clipboard

Example App does not render anything in Firefox, sometimes

Open dcaud opened this issue 2 years ago • 3 comments

The below works reliably in Chrome and Safari, but only intermittently Firefox. When it doesn't work, nothing is rendered in the Firefox browser.

library(shiny)
library(firebase)

ui <- fluidPage(
  useFirebase(), # import dependencies,
  firebaseUIContainer()
)

server <- function(input, output){
  f <- FirebaseUI$
    new()$ # instantiate
    set_providers( # define providers
      email = TRUE, 
      google = TRUE
    )$
    launch() # launch
}

shinyApp(ui, server)

The rendered HTML in Firefox (using view page source in Firefox) looks identical when it works and doesn't work. There are no errors in the Firefox console. Opening a new tab and pasting the locally generated URL (from Shiny, using RStudio) sometimes results in the expected Firebase login buttons, but sometimes does not. This appears to be a problem with how Firefox is rendering the JS or something else with Firefox (that is, the same Shiny instance sometimes works in Firefox, but sometimes doesn't).

dcaud avatar Nov 25 '22 01:11 dcaud

Can you try

server <- function(input, output){
  f <- FirebaseUI$
    new()$ # instantiate
    set_providers( # define providers
      email = TRUE, 
      google = TRUE
    )

  observe({
    launch() # launch
  })
}

JohnCoene avatar Nov 25 '22 10:11 JohnCoene

A couple notes:

  1. I could reliably reproduce the problem with my example and restarting the R session before launching the app. It seems that something is likely cached on first load, which makes subsequent loads work as expected.

  2. Your code, I presume, needs to have a "f$" in front of launch() inside the observe(). With that revision, as I've pasted below, it now seems to work as expected in Firefox -- reliably.

library(shiny)
library(firebase)

ui <- fluidPage(
  useFirebase(), # import dependencies,
  firebaseUIContainer()
)

server <- function(input, output){
  f <- FirebaseUI$
    new()$ # instantiate
    set_providers( # define providers
      email = TRUE, 
      google = TRUE
    )
  
  observe({
    f$launch() # launch
  })
}


shinyApp(ui, server)

dcaud avatar Nov 25 '22 20:11 dcaud

Indeed. The real issue here is that I am still unsure what is happening.

This has been pointed out before, I have to change the documentation but have not found the time.

JohnCoene avatar Nov 25 '22 21:11 JohnCoene