Skip to content
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

Waiter not covering Leaflet widgets entirely #143

Closed
JsLth opened this issue Oct 15, 2023 · 2 comments
Closed

Waiter not covering Leaflet widgets entirely #143

JsLth opened this issue Oct 15, 2023 · 2 comments

Comments

@JsLth
Copy link

JsLth commented Oct 15, 2023

When using a waiter on a Leaflet widget, the waiter element seems to cover only parts of the map. I'm using the newest version 0.2.5. This might be related to #126, but I'm not sure. Here's a reprex:

library(waiter)
library(shiny)
library(leaflet)

ui <- fluidPage(
  use_waiter(),
  leafletOutput("map", 400),
  actionButton("reload", "Reload map")
)


server <- function(input, output, session) {
  waiter <- Waiter$new(
    id = "map",
    html = tagList(spin_pulse(), h4("Loading map..."))
  )
  
  output$map <- renderLeaflet({
    waiter$show()
    on.exit(waiter$hide())
    Sys.sleep(3)
    leaflet(data = breweries91) %>%
      addMarkers()
  }) %>%
    bindEvent(input$reload, ignoreNULL = FALSE)
}

runApp(shinyApp(ui, server))

This issue seems to be different in different circumstances. Here is what I noticed:

  1. When initializing the map, the waiter seems to cover the entire map widget (see screenshot 1)
  2. When re-rendering the map, the waiter leaves a gap on the left side of the map widget (see screenshot 2)
  3. When inside a bs4Dash::box the waiter leaves a gap at the top of the map widget (see screenshot 2 and the code box below)

image
When initializing the map, everything looks fine.

image
When re-rendering, the waiter shows a gap on the left side.

image
When rendering in a bs4Dash::box, the gap is wider and also shows at the top. Here's the code for the UI:

library(bs4Dash)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem(text = "map", tabName = "mapTab")
    )
  ),
  dashboardBody(
    use_waiter(),
    tabItem(
      tabName = "mapTab",
      box(
       leafletOutput("map"),
        actionButton("reload", "Reload map")
      )
    )
  )
)
@JohnCoene
Copy link
Owner

Thank for the detailed bug report and reproducible example, I will take a look at that as soon as I have the time!

@JohnCoene
Copy link
Owner

Took me long enough, apologies, just pushed a fix.

Thanks again for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants