fix: show error UI when plugin has empty rows [DHIS2-16793] #3131
+112
−72
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.
Implements DHIS2-16793
Key features
Description
The key feature needs no further explanation but there are some things to take uinto consideration about the implementation:
PivotTable
component, and this is indeed where the error is thrown. However, this is really going wrong at an earlier stage: the filter condition has caused the rows to be empty, and really the plugin shouldn't have rendered thePivotTable
in the first place, but some sort of info/error screen instead. So this is what I have addressed, and I have ignored the bug in thePivotTable
. I am not sure we need to address this one.ErrorBoundary
component. I tried to implement things using one, but struggled to get this to work: somehow theonComponentDidCatch
hook never got triggered. When I realised that a solution without anErrorBoundary
was very simple (less code and no complexity), more in line with the implementation inStartScreen
, and worked at the first attempt, I decided to stick with that.TODO
Screenshots