Repository navigation
fix(frontend): refresh migrated-files list after upload (#64) - #73
Merged
Merged
Conversation
The home route loader used ensureQueryData, which returns cached data, so router.invalidate() after an upload never refetched the list. The loader now passes revalidateIfStale so the list refetches on every loader run. Adds a regression test that fails without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YPoXzBSj89ZHgw7nfTmbB
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.
Fixes #64.
Cause
The home route loader called
queryClient.ensureQueryData(filesQuery). When data is already cached, that returns the cached data without refetching. Sorouter.invalidate()after an upload re-ran the loader but got the old list back, and the new file only appeared after navigating away and back.Fix
filesQuerymoves tosrc/lib/csv.functions.ts, next tolistCsvFiles.loadFiles(queryClient)callsensureQueryDatawithrevalidateIfStale: true. With the defaultstaleTimeof 0, every loader run refetches.loadFiles.The fix sits in the loader, so it covers every
router.invalidate()caller, not only the upload path.Evidence
npx vitest run: 7 files, 96 tests passed (95 before, plus 1 new).src/__tests__/files-refresh.test.tsfails withrevalidateIfStaleremoved and passes with it.main. The remaining errors are pre-existing.Generated by Claude Code