We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
session
on()
watch()
When working with the tests/testthat/test-funs.R file I realized that the following code part does not work:
tests/testthat/test-funs.R
library(shiny) library(gargoyle) shiny::reactiveConsole(TRUE) s <- shiny::MockShinySession$new() init("pif", session = s) #> [[1]] #> reactiveVal: [1] "0" test_for_on_function <- on( "pif", { cat("TEST fails") }, session = s ) test_for_on_function$.func() #> Error in session$userData[[name]](): attempt to apply non-function shiny::reactiveConsole(FALSE)
A more specific error message is goes on:
Warning: Error in session$userData[[name]]: attempt to apply non-function 51: gargoyle::watch [/home/iz/Dropbox/r-pkgs/gargoyle/R/funs.R#107] 50: eval_tidy 49: eventFunc 36: observeEvent(gargoyle::watch("pif")) 35: contextFunc 34: env$runWith 27: ctx$run 26: run 7: flushCallback 6: FUN 5: lapply 4: ctx$executeFlushCallbacks 3: .getReactiveEnvironment()$flush 2: flushReact 1: cb
This is probably because inside the on() function:
on <- function( name, expr, session = getDefaultReactiveDomain() ){ ... observeEvent( substitute(gargoyle::watch(name)), ... }
the gargoyle::watch(name) does not update the session i.e. it should probably be gargoyle::watch(name, session = session).
gargoyle::watch(name)
gargoyle::watch(name, session = session)
May be fixed by #18
The text was updated successfully, but these errors were encountered:
fix: pass 'session'-argument from on() to watch()
edb8c82
- adding the session argument in view of ColinFay#17 and ColinFay#18 - remove redundant whitespace
Successfully merging a pull request may close this issue.
When working with the
tests/testthat/test-funs.R
file I realized that the following code part does not work:A more specific error message is goes on:
error message
Warning: Error in session$userData[[name]]: attempt to apply non-function 51: gargoyle::watch [/home/iz/Dropbox/r-pkgs/gargoyle/R/funs.R#107] 50: eval_tidy 49: eventFunc 36: observeEvent(gargoyle::watch("pif")) 35: contextFunc 34: env$runWith 27: ctx$run 26: run 7: flushCallback 6: FUN 5: lapply 4: ctx$executeFlushCallbacks 3: .getReactiveEnvironment()$flush 2: flushReact 1: cb
This is probably because inside the
on()
function:the
gargoyle::watch(name)
does not update the session i.e. it should probably begargoyle::watch(name, session = session)
.May be fixed by #18
The text was updated successfully, but these errors were encountered: