Skip to content

Migrate to React Query 5 - #1880

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

louise-davies wants to merge 6 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.08852% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.78%. Comparing base (610299d) to head (ceb2e2f).

Files with missing lines Patch % Lines
packages/datagateway-common/src/api/dois.tsx 86.98% 19 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.71%   96.78%   +0.07%     
===========================================
  Files          221      221              
  Lines        31672    31637      -35     
  Branches      4785     4755      -30     
===========================================
- Hits         30631    30620      -11     
+ Misses        1036     1013      -23     
+ Partials         5        4       -1     
Flag Coverage Δ
common 95.50% <97.50%> (-0.02%) ⬇️
dataview 98.45% <100.00%> (+0.03%) ⬆️
download 97.44% <99.20%> (+0.56%) ⬆️
search 95.65% <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 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.

@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 previously approved these changes Apr 30, 2026

@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