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:mirador_crash #3927

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

fstoe
Copy link

@fstoe fstoe commented Jul 30, 2024

I found out that adding something through the add button in the catalog view which is json but not a manifest makes the viewer crash.
steps to reproduce:

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.40%. Comparing base (3c87395) to head (3f2a803).
Report is 8 commits behind head on master.

Files Patch % Lines
src/state/selectors/manifests.js 60.00% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3927      +/-   ##
==========================================
- Coverage   92.43%   92.40%   -0.03%     
==========================================
  Files         203      203              
  Lines        3581     3583       +2     
==========================================
+ Hits         3310     3311       +1     
- Misses        271      272       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lutzhelm
Copy link
Contributor

lutzhelm commented Aug 2, 2024

Hi @fstoe, could you add a test case for that patch? createManifestoInstance itself is not exported, but getManifestoInstance calls it directly, so this would be a good place to add a test:

https://github.com/ProjectMirador/mirador/blob/master/__tests__/src/selectors/manifests.test.js#L56-L68

Something like

it('does not crash if json is not a manifest', () => {
  const state = { manifests: { x: { json: {} } } };
  const received = getManifestoInstance(state, { manifestId: 'x' });
  expect(received).toBe(undefined);
});

@fstoe
Copy link
Author

fstoe commented Aug 5, 2024

Hey @lutzhelm,
thanks for the comment. I just added a small test case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants