Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 2.9 KB

TODO-promises.md

File metadata and controls

54 lines (44 loc) · 2.9 KB

Promises TODO

Documentation

  • Motivation -- why should I care about async? Why shouldn't I (what are the limitations)?
  • High level technical overview
  • Cookbook-style examples
  • Top-down porting of a sync app to async

Core API

  • Should as.promise() convert regular values to promises? Or throw?
    • If as.promise() doesn't convert regular values to promises, add promise_resolved(value) and promise_rejected(err) functions?

later

  • Add support for multiple event loops
  • Add timeout to run_now

Error handling/debugging

  • ..stacktraceon../..stacktraceoff.. and stack traces in general
  • long stack traces
    • require opt-in
  • options(shiny.error) should work in promise handlers
  • Detect when reactives are used across process boundaries, and error

Render functions

  • Non-async render functions should have their code all execute on the current tick. Otherwise order of execution will be surprising if they have side effects and explicit priorities.
  • Promise domains should maybe have an onExecute, for the "sync" part that kicks off async operations to also have wrapping behavior (like capturing output). Right now, I have to start off renderPrint with promise(~resolve(TRUE)) and then execute the user code in a then(), just to get the promise behavior. Same will be true when we tackle error handling (stack trace capture).
  • invisible() doesn't seem to be working correctly with renderPrint. .visible doesn't survive promise chaining, e.g. promise(~resolve(promise(~resolve(invisible("Hi"))))) %>% then(function(x, .visible) { cat(.visible) }) will print TRUE, not FALSE.
  • renderDataTable should support async
  • Support downloadHandler
    • Support async filename?
    • Should prevent session from continuing until download completes (ref count)

Flush lifecycle

  • While async operations are running in a session, hold off on any further processing of inputs and scheduled task items until all operations are complete.
  • Hold all outputs/errors until async operations are complete.
  • Allow both sync and async outputs to be displayed before all outputs are done. (opt-in)

Testing

  • App that tests that all built-in render functions support async
  • Apps that test flush lifecycle, including onFlushed(once = FALSE)
  • Apps that test invisible() behavior for renderPrint, both sync and async
  • Apps that ensure all render functions execute synchronous code before tick is over
  • App that tests async downloadHandler
  • App that verifies inputs/timers don't fire for a session while it has async operations pending
  • App that verifies req(FALSE), req(FALSE, cancelOutput = TRUE), validate/need, etc. all work in async

External packages

  • DT
  • htmlwidgets: Don't require async-aware version of Shiny if not using async
  • Plotly

Bugs

  • req(FALSE, cancelOutput = TRUE) shows grey (even without async)