Skip to content

Demo of migrating annotations to RTK Query, without backwards compatibility - #4621

Draft
marlo-longley wants to merge 1 commit into
mainfrom
rtkquery-take2
Draft

marlo-longley wants to merge 1 commit into
mainfrom
rtkquery-take2

Conversation

@marlo-longley

@marlo-longley marlo-longley commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

…ibility

Obvservations in this diff:
- const { annotations } = context.miradorInstance.store.getState();
+ const annotations = getAnnotations(context.miradorInstance.store.getState());

If other people are reading .annotations directly off state instead of using the selector, RTKQ pattern will totally break that. It now lives in a another part of the state. But the selector continues to work.

Annotations apparently continue to work in the deploy preview

Screenshot 2026-10-23 at 2 11 26 PM

* @returns {object} Annotations from the state
*/
export const getAnnotations = (state) => miradorSlice(state).annotations;
export const getAnnotations = (state) => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the only part of the migration that seems to add more complexity -- I guess looking at an aggregate is hard in RTKQ? Needs a little more research.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.84848% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.8%. Comparing base (c82d038) to head (93f17d5).

Files with missing lines Patch % Lines
src/state/api/iiifBaseQuery.js 66.7% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #4621     +/-   ##
=======================================
- Coverage   94.9%   94.8%   -0.0%     
=======================================
  Files        394     395      +1     
  Lines       5850    5850             
  Branches    2002    1997      -5     
=======================================
- Hits        5550    5545      -5     
- Misses       271     275      +4     
- Partials      29      30      +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

},
},
};
case ActionTypes.IMPORT_MIRADOR_STATE:

@marlo-longley marlo-longley Oct 26, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Make sure the case is handled where we put annotations directly into state, not via HTTP/RTKQ

This branch has not been deployed

No deployments
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.

1 participant