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 functionality similar to withSpinner #105

Closed
giadasp opened this issue Sep 8, 2021 · 7 comments
Closed

waiter functionality similar to withSpinner #105

giadasp opened this issue Sep 8, 2021 · 7 comments
Assignees
Labels
feature Add new feature feedback Awaiting feedback

Comments

@giadasp
Copy link

giadasp commented Sep 8, 2021

Dear waiter developers,
I find your package really awesome but I cannot figure out how I can reproduce the withSpinner function of the shinycssloader package.
I display output elements dinamically so I cannot use their ids to assign a waiter to them.
I tried to use autoWaiter() but it works only for output elements for which I call a renderPlot function.
It seems it does not work for generic output elements like outputUI.
I make an example:
Before, I created a div in this way:

tags$div(withSpinner(uiOutput("output_name")))

and when I call output$output_name <- renderUI(tags$div("hello"))

the spinner appears and it hides when the UI is rendered.

Since I want to use only your package for this kind of tasks, I'm asking you if there is a way to reproduce this behaviour.
Thanks.

Giada

@JohnCoene JohnCoene self-assigned this Sep 10, 2021
@JohnCoene JohnCoene added the feature Add new feature label Sep 10, 2021
@JohnCoene
Copy link
Owner

Let me explore how this functionality could be integrated with waiter. (sorry for the late response)

JohnCoene added a commit that referenced this issue Oct 3, 2021
JohnCoene added a commit that referenced this issue Oct 3, 2021
@JohnCoene
Copy link
Owner

I just added this to the dev version from Github: withWaiter

Reinstall the latest version

# install.packages("remotes")
remotes::install_github("JohnCoene/waiter")

Try

library(shiny)
library(waiter)

ui <- fluidPage(
  useWaiter(),
  actionButton("draw", "plot"),
  withWaiter(
    plotOutput("plot")
  )
)

server <- function(input, output, session){
  output$plot <- renderPlot({
    input$draw
    Sys.sleep(5)
    plot(cars)
  })
}

shinyApp(ui, server)

@JohnCoene JohnCoene added the feedback Awaiting feedback label Oct 3, 2021
JohnCoene added a commit that referenced this issue Oct 3, 2021
JohnCoene added a commit that referenced this issue Oct 3, 2021
@JohnCoene
Copy link
Owner

I'm assuming this is sorted and closing, feel free to reopen if it is not

@giadasp
Copy link
Author

giadasp commented Nov 22, 2021

When are you going to update the package on CRAN?

@JohnCoene
Copy link
Owner

The latest version 0.2.4 includes withWaiter. What are you after?

@apalacio9502
Copy link

Hi Jhon, the new functionality is very good. However it doesn't work for me for plotly or DT.

Here is an example with plotly.

`library(shiny)
library(waiter)

ui <- fluidPage(
useWaiter(),
actionButton("draw", "plot"),
withWaiter(
plotlyOutput("plot"))
)

server <- function(input, output, session){
output$plot <- renderPlotly({
input$draw
Sys.sleep(5)
x <- c(1:100)
random_y <- rnorm(100, mean = 0)
data <- data.frame(x, random_y)
plot_ly(data, x = ~x, y = ~random_y, type = 'scatter', mode = 'lines')
})
}

shinyApp(ui, server)`

@HugoGit39
Copy link

Does it already works with plotly? Cause I also can not get it to work

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

No branches or pull requests

4 participants