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: avoid reading from undefined error (DHIS2-17334) #2970

Merged
merged 1 commit into from
May 8, 2024

Conversation

edoardo
Copy link
Member

@edoardo edoardo commented May 3, 2024

Fixes DHIS2-17334


Key features

  1. fix read from undefined crash

Description

This happened when using "View as" from Map to DV with some filters applied.
The reason is that item in that case is the Map item, and does not have the visualization key.
The tag part only make sense when rendering an Outlier table visualization type.
The fix makes sure the item is of type VISUALIZATION and then checks if the visualization type is an Outlier table one.


Screenshots

Before:
Screenshot 2024-05-03 at 15 26 00

After:
the leftmost item is a Map one, and can be viewed as Chart even with filters applied
Screenshot 2024-05-03 at 15 26 26

the rightmost item is a Visualization of type Outlier table and should render a tag informing about some filters not applied (Area in the example)
Screenshot 2024-05-03 at 15 26 38

When using View as with filters applied.
@edoardo edoardo requested a review from jenniferarnesen May 3, 2024 13:29
@dhis2-bot
Copy link
Contributor

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

@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2024 13:32 Inactive
@@ -232,8 +232,9 @@ class Item extends Component {
}
case CHART:
case VISUALIZATION: {
return item.visualization.type ===
VIS_TYPE_OUTLIER_TABLE &&
return item.type === VISUALIZATION &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any use for the originalType here? Check the function getItemTypeForVis

@edoardo edoardo merged commit a4e5340 into dev May 8, 2024
24 of 26 checks passed
@edoardo edoardo deleted the fix/view-as-with-filter-crash-DHIS2-17334 branch May 8, 2024 12:03
@cypress cypress bot mentioned this pull request May 8, 2024
dhis2-bot added a commit that referenced this pull request May 16, 2024
## [100.2.2](v100.2.1...v100.2.2) (2024-05-16)

### Bug Fixes

* avoid re-rendering an item when adding the same again (DHIS2-17016) ([#2935](#2935)) ([dd67fc6](dd67fc6))
* avoid reading from undefined error (DHIS2-17334) ([#2970](#2970)) ([a4e5340](a4e5340))
* dimension list design (DHIS2-16270) ([#2861](#2861)) ([790afd2](790afd2))
* system / user setting for display name not respected in Org Unit tree (DHIS2-15000) ([#2971](#2971)) ([928b88a](928b88a))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

kabaros pushed a commit that referenced this pull request May 31, 2024
## [100.2.2](v100.2.1...v100.2.2) (2024-05-16)

### Bug Fixes

* avoid re-rendering an item when adding the same again (DHIS2-17016) ([#2935](#2935)) ([dd67fc6](dd67fc6))
* avoid reading from undefined error (DHIS2-17334) ([#2970](#2970)) ([a4e5340](a4e5340))
* dimension list design (DHIS2-16270) ([#2861](#2861)) ([790afd2](790afd2))
* system / user setting for display name not respected in Org Unit tree (DHIS2-15000) ([#2971](#2971)) ([928b88a](928b88a))
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