-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: lazily load plugin scripts and dependencies when needed (DHIS2-10518) #1546
Conversation
I'm getting a bunch of errors on the production instance resulting in ev not rendering:
|
@jenniferarnesen the duplication of
|
Strange that we're seeing the EV EXT error now though.... i am seeing it too but it was working for me before. Will have to investigate that. |
Re: the EV EXT error This error also appears on the current dashboard https://debug.dhis2.org/2.35dev/dhis-web-dashboard/#/PZIxO0YLxFt -- the eventchart.js plugin tries to use EXT to show an alert saying "the user admin doesn't have access to this program", but there's no EXT available (that's only in the app itself). It works with the system user, which has access to all programs. So this appears to be a bug in the EV plugin and/or we need to also load EXT when loading that plugin (which can be done but... ew) |
@jenniferarnesen I've updated this a bit (better late than never) to add loading mask and remove console logs, the implementation changed a bit to support this. Think we can get this in to 2.36 before the hard freeze? |
onLoadingComplete={this.onLoadingComplete} | ||
forDashboard={true} | ||
style={pluginProps.style} | ||
userSettings={{ | ||
displayProperty: this.context.userSettings | ||
.keyAnalysisDisplayProperty, | ||
}} |
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.
forDashboard
, userSettings
and onLoadingComplete
could be moved to DataVisualizerPlugin. Should be pretty straightforward (onLoadingComplete just sets a state var that is only relevant for DataVisualizerPlugin). But if you don't have time for this, I can do it. If its not done by noon (either by me or you), then let's just go ahead and merge as is, and I can do this later.
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.
Changes committed
@jenniferarnesen nice, much cleaner thanks! Changes look good, shall we merge? 👍 |
# [31.14.0](v31.13.10...v31.14.0) (2021-03-11) ### Features * lazily load plugin scripts and dependencies when needed (DHIS2-10518) ([#1546](#1546)) ([c13eafe](c13eafe))
🎉 This PR is included in version 31.14.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
import()
the Data Visualizer plugin so that it can be code-split out of the main bundle. (NOTE: for this to really be useful it requires a tree-shakable analytics library, which we don't have yet)This also removes the need for a custom index.html and for setting any environment variables in development
DV and Maps plugins will hopefully move to dynamic modules, but this solution will still be required for eventReports and eventVisualizer
Here is a production example : https://debug.dhis2.org/2.35dev/api/apps/dashboard2/index.html#/Goz4vyRx2cy
NOTE: ER and EV plugins don't work locally because of CORS
TODO:
prefetch
,preload
, or neither fordata-visualizer-plugin
chunk (currently prefetching)<LoadingMask>
while fetching scripts