Skip to content
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: fix props handling when switching Map <-> DV plugins #2272

Merged
merged 2 commits into from
Mar 24, 2023

Conversation

edoardo
Copy link
Member

@edoardo edoardo commented Mar 23, 2023

Key features

  1. fix problem when switching between Map and DV using "View as"

Description

When using "View as" and switching between Map and chart/table or viceversa, the plugin loaded in the iframe needs to change.
This transition didn't work because the message listener in dashboard was not in place when the plugin requested getProps, resulting in the Map/chart/table not showing.
Switching between chart and table worked because in that case the plugin does not change and the newProps message is used instead of getProps.

The getProps listener is still removed in the cleanup function returned by the useEffect, but it's recreated if the iframe src change (plugin change).

After the first getProps message is received there shouldn't be other getProps messages incoming, but newProps is used for passing new/modified props instead.


Screenshots

Before:
https://user-images.githubusercontent.com/150978/227541666-4c0ec880-0eed-4b8f-bce0-3656bddb5284.mov

After:
https://user-images.githubusercontent.com/150978/227542408-996b818a-c1ba-473e-b007-5d2f60c762f5.mov

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Mar 23, 2023

🚀 Deployed on https://pr-2272--dhis2-dashboard.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify March 23, 2023 15:58 Inactive
@cypress
Copy link

cypress bot commented Mar 23, 2023

Passing run #3223 ↗︎

0 51 0 0 Flakiness 0

Details:

chore: clean up code, remove debugging logs
Project: dashboards-app Commit: f6520f1daf
Status: Passed Duration: 04:46 💡
Started: Mar 24, 2023 2:54 PM Ended: Mar 24, 2023 2:59 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@dhis2-bot dhis2-bot temporarily deployed to netlify March 24, 2023 12:27 Inactive
@edoardo edoardo marked this pull request as ready for review March 24, 2023 14:03
@edoardo edoardo merged commit 7a06ab9 into master Mar 24, 2023
@edoardo edoardo deleted the fix/view-as-issues branch March 24, 2023 15:11
dhis2-bot added a commit that referenced this pull request Mar 24, 2023
## [99.10.23](v99.10.22...v99.10.23) (2023-03-24)

### Bug Fixes

* fetch repetition data for LL to show in plugin ([#2271](#2271)) ([25378ce](25378ce))
* fix props handling when switching Map <-> DV plugins ([#2272](#2272)) ([7a06ab9](7a06ab9))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 99.10.23 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

jenniferarnesen added a commit that referenced this pull request May 3, 2023
* fix: consolidate legacy and default plugin and fix resizing (#2254) (#2268)

* fix: consolidate legacy and default plugin and fix ER/EV resizing

* fix: show offline message on EE maps

---------

Co-authored-by: Jan Henrik Øverland <janhenrik.overland@gmail.com>

* fix: fix props handling when switching Map <-> DV plugins (#2272)

* feat(iframe-plugin): wait to load plugins from cache to save network [DHIS2-15097] (#2285)

* feat(iframe-plugin): receive pwa installation status from plugins

* chore: add todos

* fix: wait to render until the first item of the type has gotten the plugin

* fix: add property to the top-most item of each iframe plugin type

* fix: dont use the <Layer> component

* chore: cli-app-scripts upgrade

* fix: remove unused var

* refactor: combine loops

---------

Co-authored-by: Jen Jones Arnesen <jennifer@dhis2.org>

* fix: disable ll plugin if it doesnt support installationStatus

* fix: clean up and lint

* fix: handle case where LL is not installed

* fix: center spinner

---------

Co-authored-by: Jan Henrik Øverland <janhenrik.overland@gmail.com>
Co-authored-by: Edoardo Sabadelli <edoardo@dhis2.org>
Co-authored-by: Kai Vandivier <49666798+KaiVandivier@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants