Skip to content

Shiny 1.12.0 leads to double icons and labels in bs4Dash::actionButton() when using updateActionButton() #406

@splendiduser

Description

@splendiduser

Please see the result of this app when pressing the primary action button:

library(shiny)
library(bs4Dash)

ui <- fluidPage(
  h3("Icon Toggle Module Example"),
  bs4Dash::actionButton(
    "icon_btn_1",
    label = "bs4Dash Button",
    icon = icon("play")
  ),
  shiny::actionButton(
    "icon_btn_2",
    label = "shiny Button",
    icon = icon("play")
  ),
  actionButton(
    "toggle_btn",
    label = "Toggle Icon and Label",
    class = "btn-primary"
  )
)

server <- function(input, output, session) {
  state <- reactiveVal("play")
  
  observeEvent(input$toggle_btn, {
    new_state <- if (state() == "play") "pause" else "play"
    state(new_state)
    
    updateActionButton(
      session,
      "icon_btn_1",
      icon = icon(new_state),
      label = "new label"
    )
    
    updateActionButton(
      session,
      "icon_btn_2",
      icon = icon(new_state),
      label = "new label"
    )
  })
}

shinyApp(ui, server)

EDIT: Simplified version of the app. I forgot to remove the unnecessary module logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions