-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Implement support for clientside callbacks in Dash for R #130
Conversation
Sample app (cf. https://community.plot.ly/t/dash-0-41-0-released/22131):
|
namespace = 'clientside', | ||
function_name = 'display' | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we allow app$callback
to accept either an R function
or a clientsideFunction
, determine which it is based on type, and do away with app$clientside_callback
? It's a little different from Python, but that's just because of Python's decorators vs R's anonymous functions. It's still plenty clear, I think, as you've still got an explicit call to clientsideFunction
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered about that as I was working on this PR; using the same syntax for both seems perfectly fine to me. I'll go ahead and make this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in e4fffaf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! just one small suggestion https://github.com/plotly/dashR/pull/130/files#r330202703 and trailing whitespace, then 💃
Co-Authored-By: alexcjohnson <johnson.alex.c@gmail.com>
Right, sorry about that. RStudio has been configured to 🔪 trailing whitespace, but my
Using a keystroke to make the change manually before save is working, so will use that going forward:
|
* Provide support for no_update in Dash for R (#111) * Use dev_tools_prune_errors instead of pruned_errors (#113) * Better handling for user-defined error conditions in debug mode (#116) * Provide support for multiple outputs (#119) * Provide support for hot reloading in Dash for R (#127) * Implement support for clientside callbacks in Dash for R (#130) * Add line number context to stack traces when srcrefs are available (#133) * Update dash-renderer to 1.2.2 and fix dev tools UI display of stack traces (#137) * Support for meta tags in Dash for R (#142) * Fixes for hot reloading interval handling and refreshing apps within viewer pane (#148) * Support for asynchronous loading/compression in Dash for R (#157) * Support returning asset URLs via public method within Dash class (#160) * Minor fix for get_asset_url + docs, add url_base_pathname (#161)
This PR proposes modifications to support clientside callbacks in Dash for R, as they currently exist in Dash for Python (plotly/dash/issues/266, plotly/dash/pull/672, plotly/dash-renderer/pull/143).
Specifically, the following changes are proposed:
clientsideFunction
which allows app developers to reference a JavaScript function and its namespaceinsertIntoCallbackMap
to accept either an R function or a JavaScript functionassert_valid_callbacks
to permit either a function to be passed into thecallback_map
, or a reference to a JavaScript function (provided that the object's names arenamespace
andfunction_name
)_dash-dependencies
route handler to addclientside_function
to the JSON payloadCloses #129.