Appsilon / shiny.emptystate

Empty state components for Shiny
https://appsilon.github.io/shiny.emptystate/
27 stars 2 forks source link

[Bug]: #15

Closed DavZim closed 2 years ago

DavZim commented 2 years ago

Guidelines

Project Version

0.0.0.9000

Platform and OS Version

Windows 10

Existing Issues

No response

What happened?

When using the example app from the Readme with the EmptyStateManager, it seems that the state is not a binary state but an integer state. That means, that if I click three times on "Show empty state!", I need to click four times on "Hide empty state!".

Steps to reproduce

Use the app:

library(shiny)
library(shiny.emptystate)
library(reactable)

ui <- fluidPage(
  use_empty_state(),
  actionButton("show", "Show empty state!"),
  actionButton("hide", "Hide empty state!"),
  reactableOutput("my_table")
)

server <- function(input, output, session) {
  empty_state_content <- div(
    "This is  example empty state content"
  )

  empty_state_manager <- EmptyStateManager$new(
    id = "my_table",
    html_content = empty_state_content
  )

  observeEvent(input$show, {
    empty_state_manager$show()
  })

  observeEvent(input$hide, {
    empty_state_manager$hide()
  })

  output$my_table <- reactable::renderReactable({
    reactable(iris)
  })
}

shinyApp(ui, server)

Click a couple of times on "Show empty state!" and now try to hide the empty state again.

Expected behavior

When clicking Hide Empty State I expect to hide the empty state regardless of how many times I have clicked on "Show Empty State"

Attachments

No response

Screenshots or Videos

No response

Additional Information

No response

vedhav commented 2 years ago

Hey David! Thanks for checking out our new package. I just added a commit to fix this issue, it's in review before it could be merged. But if you wish to get the fix right away, you could try installing using this command:

devtools::install_github("Appsilon/shiny.emptystate", ref="5cd14515702ac690e83a0c38962cb0bf8e168a96")

Make sure to restart your R session after re-installing it!