Skip to content

running into JS issues when using waiter with bslib packakge #148

@gadepallivs

Description

@gadepallivs

I'm trying to place waiter on page load. Not sure how to use this. My shiny app is structured with page_navbar, and bslib::nav_panel. If I use waiter within those, I get a warning as below and waiter does not display

Warning message:
Navigation containers expect a collection of `bslib::nav_panel()`/`shiny::tabPanel()`s and/or `bslib::nav_menu()`/`shiny::navbarMenu()`s. Consider using `header` or `footer` if you wish to place content above (or below) every panel's contents. 

if I wrap the waiter under page_fluid and all page nav bar under this, the waiter works and the page_navbar displays properly. However, the popver does not work when I click on the gear icon. if I remove the waiter code, everything just works fine.

Am I calling the waiter in the wrong way ?

library(shiny)
library(bslib)
#> 
#> Attaching package: 'bslib'
#> The following object is masked from 'package:utils':
#> 
#>     page
library(waiter)


ui <- bslib::page_fluid(
  useWaiter(),
  useHostess(),
  waiterShowOnLoad(
    color = "#f7fff7",
    hostess_loader(
      "loader",
      preset = "circle",
      text_color = "black",
      class = "label-center",
      center_page = TRUE
    )
  ),
  page_navbar(
    title = "My App",
    bslib::nav_panel(
      title = "One",
      card(
        class = "mt-5",
        card_header(popover(
          bsicons::bs_icon("gear", title = "Settings"),
          title = "Settings",
          sliderInput("n", "Number of points", 1, 100, 50)
        )),
        "The card body..."
      )
    )
  )
)

server <- function(input, output) {
  hostess <- Hostess$new("loader")

  for (i in 1:10) {
    Sys.sleep(runif(1) / 2)
    hostess$set(i * 10)
  }

  waiter_hide()
}

shinyApp(ui, server)
Shiny applications not supported in static R Markdown documents

Created on 2024-03-23 with reprex v2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions