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

Should have function to wait for input to be a certain value #301

Closed
wch opened this issue Jan 23, 2020 · 0 comments · Fixed by #304
Closed

Should have function to wait for input to be a certain value #301

wch opened this issue Jan 23, 2020 · 0 comments · Fixed by #304
Assignees

Comments

@wch
Copy link
Collaborator

wch commented Jan 23, 2020

For example, this waits until input$state is a value other than NULL or "".

for (i in 1:100) {
  state <- try(app$getValue("state", "input"))
  if (inherits(state, "try-error") || identical(state, "")) {
    Sys.sleep(0.2)
  } else {
    break
  }
}

As seen in https://github.com/rstudio/shinycoreci-apps/blob/73997616e9d2f6584cded524ad46faf44154d4e2/021-selectize-plot/tests/shinytests/mytest.R

This should also be documented on the website, possibly in the FAQ.

Also, we might need to check how long getValue will block for before it times out. Ideally, we'd be able to call it with a short timeout.

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

Successfully merging a pull request may close this issue.

2 participants