Skip to content

Migrate to React Query 5#1880

Open
louise-davies wants to merge 5 commits into
developfrom
react-query-5
Open

Migrate to React Query 5#1880
louise-davies wants to merge 5 commits into
developfrom
react-query-5

Conversation

@louise-davies

@louise-davies louise-davies commented Mar 9, 2026

Copy link
Copy Markdown
Member

Description

See title. Main breaking changes were the changes to useInfiniteQuery, the removal of exact: false to setQueryData/getQueryData and thus having to use setQueriesData/getQueriesData, removing onError handlers and instead using query meta and a global error handler i nthe query cache, some changes to useMutation, renaming loading state to pending and isInitialLoading to isLoading.

Plus I added the eslint plugin for react query so fixing a lot of things there, mostly because URLs were not in query keys. We could just ignore these errors, but that means we don't get the full power of the linter, and in most cases added them to the query key is fine. It makes finding exact query keys harder but I think I've worked around it sufficiently. Due to adding the linter I based this branch off of the eslint branch.

Testing instructions

Add a set up instructions describing how the reviewer should test the code

  • Review code
  • Check Actions build
  • Review changes to test coverage
  • Give a good general test of e.g. infinite queries, mutations etc. as they're the ones with the most refactoring work done to them

- fixed all errors
- started fixing unit tests
- started refactoring to use skip/limit directly as page params in infinite queries
@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.23188% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.78%. Comparing base (fe4ddad) to head (063f69b).

Files with missing lines Patch % Lines
packages/datagateway-common/src/api/dois.tsx 85.61% 21 Missing ⚠️
...earch/src/card/datasetSearchCardView.component.tsx 41.93% 17 Missing and 1 partial ⚠️
...search/src/table/datafileSearchTable.component.tsx 48.38% 16 Missing ⚠️
...-search/src/table/datasetSearchTable.component.tsx 48.38% 16 Missing ⚠️
...kages/datagateway-download/src/downloadApiHooks.ts 98.74% 4 Missing ⚠️
.../downloadCart/urlBuilders/buildInvestigationUrl.ts 97.36% 2 Missing ⚠️
...ad/src/downloadCart/urlBuilders/buildDatasetUrl.ts 98.36% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1880      +/-   ##
===========================================
+ Coverage    96.70%   96.78%   +0.07%     
===========================================
  Files          219      219              
  Lines        30938    30906      -32     
  Branches      4616     4587      -29     
===========================================
- Hits         29919    29911       -8     
+ Misses        1015      990      -25     
- Partials         4        5       +1     
Flag Coverage Δ
common 95.38% <97.24%> (-0.02%) ⬇️
dataview 98.59% <100.00%> (+0.03%) ⬆️
download 97.47% <99.20%> (+0.57%) ⬆️
search 95.64% <55.35%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@louise-davies louise-davies marked this pull request as ready for review March 9, 2026 15:59
Base automatically changed from eslint-upgrade to develop March 10, 2026 16:17

@joshdimanteto joshdimanteto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, there are a couple of files where the line endings has changed but it's changing from windows to linux so I'm happy 😊

Image

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.

2 participants