-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Async JavaScript Lazy Loading #899
Conversation
# Conflicts: # dash-renderer/src/actions/index.js
devtools were using |
added a shimmed test for |
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! I have no further comments, let's do it! 💃 🐎 🚀
…ash-4.17.21 Bump lodash from 4.17.10 to 4.17.21
…17.21 Bump lodash from 4.17.10 to 4.17.21
Realted to component-specific implementations:
plotly/dash-core-components#616
plotly/dash-table#554
Component loading state is exposed on the component class / function.
The renderer evals the loading state of all component types on layout changes (possibility of new component types).
notifyObserver
uses this state to decide whether to go forward with callbacks or wait.Because of callback chains and multi-input & state parameters, it's not possible to only depend on the state of the current component. This may result in more overhead vs. checking out only the state of the (1) components in the dependency graph, (2) components impacted by the callback's dependency chain, but it feels like a good first implementation.
Dash now supports a new attribute on
_js_dist
assets:async
.async
can't be used withdynamic
and is instead used to determine at runtime if an asset should beeager
orlazy
. Takes three values: True,eager
,lazy
.This is necessary to cover cases like the dcc.Graph plotly.js dependency -- we need
window.Plotly
to be set automatically if eagerly loaded, for the value to already be set after DOM render, for legacy purposes.Special webpack plugin to redirect Dash dynamic imports correctly, byt taking into account the Dash path structure webpack-dash-dynamic-import
Common code for all async components to use to make the renderer aware of their 'aysnc' nature dash-component-plugins -- this was made more general with thoughts of adding other plugins here (e.g. the private layout could be abstracted here for components that need it)
Test Dash resolution of
async
with different values foreager_loading
andforce_eager_loading
flagsValidate
lazy
requests are not loaded right away (e.g. DOM comparison)Test
setAppIsReady
with shim -- make sure callbacks are blockedAdditional performance work that could be done here or spin off new PRs:
<head>
, the other can stay were it is atm<head>
instead of<body>
-- wait for DOM from therecore-js
in renderer, externalized for all other components (renderer to pullall
instead ofusage
) -- need to coordinate targets?v=x.y.z
with the version instead of the timestamp -- keep using the timestamp for debugIn order of priority / potential gains, stopping cache busting in production code is probably the biggest (and easiest) gain we can get.