Closed mandyparson closed 1 month ago
Attention: Patch coverage is 75.00000%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 97.65%. Comparing base (
960eb4f
) to head (31d009b
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Overview
What is the bug?
Errors occur during two particular use cases:
Collections >> Collection >> Clone >> 'Cannot destructure property \'nativeId\' of \'Tr\' as it is null.' (this error comes from DraftPage.jsx line 90 when MMT tries to ask for the draft but the draft doesn't exist in CMR yet)
Collections >> Collection >> Clone >> Edit >> Save & Publish >> 'Cannot destructure property \'granules\' of \'Cr\' as it is null.' (this error comes from PublishPreview.jsx line 101 when MMT tries to ask for the published record but it doesn't exist in CMR yet)
Please summarize the feature or fix.
Initially, the thought was that we should use useHistory for this bug. If a user is coming from publishpreview or is coming from draftpage, then render a refresh banner. But there are two issues with this: 1) useHistory is not supported for react-router v6 or above. https://stackoverflow.com/questions/63471931/using-history-with-react-router-dom-v6 it is recommended that you use useNavigation. If you looke up history npm, the use cases are only for actions and blocking certain transitions. There does not appear to be an array of pash urls saved for reference. 2) Even if I could access history, I don't believe it is wise to use a url as a metric for what error to throw. What if a user does another type of action on PublishPreview or DraftPage that causes an error? It would throw a refresh banner no matter what.
Rather than use useHistory, I have opted to render a refresh banner based on those repeatable errors I listed above.
What is the Solution?
Adding knownCMRLagErrors to ErrorBanner
What areas of the application does this impact?
ErrorBanner.jsx
Testing
Reproduction steps
Attachments
Please include relevant screenshots or files that would be helpful in reviewing and verifying this change.
Checklist