React query caching fixes cherry pick - #40615
Merged
nulmete merged 2 commits intoFeb 26, 2026
Merged
Conversation
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #40606 # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [x] QA'd all new/changed functionality manually https://github.com/user-attachments/assets/ab873ea4-2baa-4218-b16c-c75f16bbda34 For unreleased bug fixes in a release candidate, one of: - [x] Confirmed that the fix is not expected to adversely impact load test results - [ ] Alerted the release DRI if additional load testing is needed
) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #40408 Part of the root cause for this issue is this commit: 5136d40 In summary, I moved the QueryClient instantiation out of AppWrapper because it needs to be a stable reference. I realized this was necessary when manipulating react-query's cache as part of that work. (I was debugging react-query's cache using **getQueryData** and it was always returning **undefined** for every entry -- that was fixed by doing what I described just above). When QueryClient was re-created on each AppWrapper mount, refetchOnMount: false had no effect.. there was never cached data to serve, so useQuery always fetched on every navigation to the host details page. After moving it out of AppWrapper, refetchOnMount: false works as expected and the cached (stale) data is served instead of refetching. The fix removes the refetchOnMount: false, refetchOnReconnect: false, and refetchOnWindowFocus: false overrides, restoring react-query's defaults so data is refreshed on navigation, tab focus, and reconnect. # Checklist for submitter - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [x] QA'd all new/changed functionality manually https://github.com/user-attachments/assets/fa3f90ef-46f4-4a30-acc6-2176a22e8299 For unreleased bug fixes in a release candidate, one of: - [x] Confirmed that the fix is not expected to adversely impact load test results - [ ] Alerted the release DRI if additional load testing is needed
cdcme
approved these changes
Feb 26, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## rc-minor-fleet-v4.82.0 #40615 +/- ##
=========================================================
Coverage ? 66.34%
=========================================================
Files ? 2453
Lines ? 196260
Branches ? 8730
=========================================================
Hits ? 130209
Misses ? 54255
Partials ? 11796
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picking fixes for #40608 and #40603 (already merged to main)