-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix: avoid sending props twice when using View as and plugin changes #2248
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🚀 Deployed on https://pr-2248--dhis2-dashboard.netlify.app |
jenniferarnesen
approved these changes
Mar 16, 2023
dhis2-bot
added a commit
that referenced
this pull request
Mar 16, 2023
## [99.10.18](v99.10.17...v99.10.18) (2023-03-16) ### Bug Fixes * avoid sending props twice when using View as and plugin changes ([#2248](#2248)) ([be17d00](be17d00))
🎉 This PR is included in version 99.10.18 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
janhenrikoverland
pushed a commit
that referenced
this pull request
Mar 17, 2023
jenniferarnesen
pushed a commit
that referenced
this pull request
Mar 22, 2023
jenniferarnesen
pushed a commit
that referenced
this pull request
Mar 22, 2023
jenniferarnesen
pushed a commit
that referenced
this pull request
Mar 22, 2023
jenniferarnesen
pushed a commit
that referenced
this pull request
Mar 22, 2023
This was referenced Mar 22, 2023
jenniferarnesen
added a commit
that referenced
this pull request
Mar 22, 2023
…v40] (#2266) * fix: unwanted re-rendering of dashboard items (#2247) * fix: solve most unwanted re-renders of dashboard items This is basically reverting a change I added to solve a DV Highchart's cutoff issue. I think I found another approach for that issue which does not require to pass style to the plugin, which is a problem because of course it changes any time the dashboard item container changes size (window resize, resize of other dashboard items, interpretation panel toggle, etc...). * chore: bump cli-app-scripts to solve no-service-worker issue * fix: avoid sending props twice when using View as and plugin changes (#2248) * fix: use chrome in e2e tests --------- Co-authored-by: Edoardo Sabadelli <[email protected]>
jenniferarnesen
added a commit
that referenced
this pull request
Mar 23, 2023
…ch/2.40.0] (#2267) * fix: unwanted re-rendering of dashboard items (#2247) * fix: solve most unwanted re-renders of dashboard items This is basically reverting a change I added to solve a DV Highchart's cutoff issue. I think I found another approach for that issue which does not require to pass style to the plugin, which is a problem because of course it changes any time the dashboard item container changes size (window resize, resize of other dashboard items, interpretation panel toggle, etc...). * chore: bump cli-app-scripts to solve no-service-worker issue * fix: avoid sending props twice when using View as and plugin changes (#2248) --------- Co-authored-by: Edoardo Sabadelli <[email protected]> Co-authored-by: Jan Henrik Øverland <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I discovered this problem when testing the "View as" feature in dashboard.
The problem was that props where sent twice to the plugin and I think some of the postRobot timeout errors where a consequence of that.
This is what happened.
When using "View as" and switching app, ie. from DV to Maps and viceversa, the plugin loaded in the iframe needs to change.
This causes the "new" plugin to send the
getProps
message to dashboard, but at the same timepluginProp
in dashboardIframePlugin
component changes (the visualization object is adapted for DV/Maps) which causesnewProps
message to be sent from dashboard to the plugin.The props are then sent twice, which would cause a re-render of the plugin.
I also suspect some of the postRobot console errors are due to
newProps
being sent while the listener in the plugin is not yet available.This refactor uses the same approach used in the "future" component in app-runtime, currently in the alpha branch:
https://github.com/dhis2/app-runtime/blob/alpha/services/plugin/src/Plugin.tsx