feat: cleanup plugin error boundary [UX-136] #856
Merged
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.
This PR implements styling for plugin error boundaries (see notes on https://dhis2.atlassian.net/issues/UX-136)
https://dhis2.atlassian.net/browse/LIBS-633
Style note on screenshots: note that the teal background / dotted blue line is styling from the app (that is the styling around the plugin). The actual plugin error boundaries are the the grey boxes 9
General note: Off-ticket, I think Joe and I discussed that it might be better to not vertically center the plugin error message (because there's a greater likelihood that you would not see the error in the plugin if it's centered within the iframe). If we did actually want vertically centering, that's a small edit from this.
Default plugin error:
This is the error that you would get if something goes wrong within the plugin's code.
Before
After
-Note: The parent iframe needs to enable write access to the clipboard in order to copy the error to the clipboard. I've submitted a PR in app-runtime to make the iframe rendered by component include that access. If you implement your own wrapper, you'd need to provide that access yourself.
-To do: the ticket discusses passing the name of the plugin within the error. The premise for that was that the plugin name would be the shortName provided to the app-runtime component for looking up iframe src. I think before adding this shortName, we should revist the actual implementation of the plugin lookup, as I think most people are just passing urls for the src at the moment.
Outer plugin error:
This is the error that you would get if something went wrong with the app-shell logic for loading the plugin. It should (hopefully 😅) be very unlikely that you would end up in this error state, so I've just left this error as a simple "something went wrong" rather than including/refactoring all the additional code for copying error info / trying again.
Before:
After: