builtin_handler_shiny
results in Error: attempt to apply non-function
#762
Labels
bug
an unexpected problem or unintended behavior
Dear
cli
maintainer, I recently encountered an issue ropensci/targets#1478 (please check this issue for more detailed examples)The
targets
package probably tried usingcli
progress bar before initialized ("add") or after completion, resulting in an error. The related code is herehttps://github.com./r-lib/cli/blob/main/R/progress-server.R#L356C1-L365C5
We see that shiny progress is set to
NULL
, and then trying to access functions such asoutput
orset
will raise errors.Basically if shiny ends the progress bar
builtin_handler_shiny$complete()
and the program still tries to callbuiltin_handler_shiny $output()
, then the code will error out in shiny app. However, the code works fine outside of shiny, which makes the debugging process extremely hard.I understand that if the package is used super carefully, then this issue will not occur. However, it is often the case that the package does not mandate what people do, especially when the code just works for most of people. Considering that other handlers do not raise errors on "use-after-free", and condition that triggers this error, this inconsistency is super hard to debug/find.
However, could we add checks just to make sure the functions are not that stringent? Alternatively, if you would like to ensure consistent behavior, we can force
set
andoutput
to result in errors after completion for other functions.The text was updated successfully, but these errors were encountered: