-
-
Notifications
You must be signed in to change notification settings - Fork 32
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 asynchronous loading in Dash for R #157
Conversation
fix variable name and parens
# need assert that async and dynamic are not both present | ||
if ( | ||
(!is.null(resource$dynamic) && (resource$dynamic == FALSE)) || | ||
(eager_loading==TRUE && !is.null(resource$async) && (resource$async %in% c("eager", TRUE))) |
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.
Nonblocking.
Since the async/dynamic values are generated (as opposed to the Python values, that are hard-coded, maybe it's not as important to guard for the case where both dynamic and async are defined. Still nice to have.
We could avoid the if(true) -> false
cases and rewrite the whole func as:
return (!is.null(resource$dynamic) || !is.null(resource$async)) &&
(is.null(resource$dynamic) || resource$dynamic == TRUE) &&
(eager_loading == FALSE || is.null(resource$async) || !(resource$async %in% c("eager", TRUE))
# RStudio | ||
tryBrotli <- request$accepts_encoding('br') | ||
if (tryBrotli == "br") { | ||
response$body <- brotli::brotli_compress(charToRaw(response$body), |
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.
🥔
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.
🍠
extension) | ||
} | ||
|
||
checkFingerprint <- function(path) { |
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.
Nonblocking. I was a bit confused about the fingerprint check for a few minutes because I did not see anything to handle /
paths like in the Python impl, but it's being handled in the caller and only the filename portion of the path is passed here. Maybe renaming path
to filename
for clarity.
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.
Actually, the path is passed here -- hence the subsequent call to basename
, which extracts the filename from the complete path if provided. I think I'll leave path
as-is, though the earlier call to checkFingerprint
could be written with path
instead of filename
to avoid confusion.
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.
Two nonblocking comments. lgtm
* 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 to provide performance enhancements previously offered in plotly/dash#899. Briefly, it will implement the following:
eager_loading
flag to permit automatic loading of components, as beforeeager_loading
andasync
ordynamic
attributes for dependencies, which will optionally prevent serving of script tags in the index for certain components (thereby allowing them to load on-demand)brotli
,gzip
anddeflate
compression of text resourcesCloses #134.