fix: cover recipes/kitchens in low-volatility cache refresh - #352
Merged
Conversation
Recipe.is_cooking_recipe() started returning real recipes after #350/#351, but the cooking-test instance's Recipe browse page kept showing "No recipes yet": RecipeListView/KitchenListView query under queryKey ["recipes"]/["kitchens"], persisted to localStorage with a 1h staleTime, and neither key was in LOW_VOLATILITY_QUERY_KEYS -- so the "Refresh data" control in NavBar had no way to invalidate the empty result a browser had already cached from before the backend fix. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Diagnosed why the
cooking-testinstance still showed "No recipes yet" inthe browser after #350/#351 fixed the backend: it's a client-side cache
issue, not a backend regression.
RecipeListView/KitchenListViewquery under["recipes"]/["kitchens"],persisted to
localStoragewith a 1hstaleTime(seequeryClient.ts).LOW_VOLATILITY_QUERY_KEYS, so the "Refresh data"control (NavBar) had no way to invalidate a recipes result a browser had
already cached from before the backend fix -- it would keep serving the
stale empty list until the 1h staleTime elapsed on its own.
curl .../v1/api/okh/recipes)that all 3 recipes are returned correctly; the gap is purely this
browser-side cache never being told to refetch.
Fix
Add
["recipes"]and["kitchens"]toLOW_VOLATILITY_QUERY_KEYS, soclicking "Refresh data" invalidates and refetches them like the other
low-volatility datasets (OKH manifests, OKW facilities, packages).
Test plan
npx vitest run src/queryClient.test.ts-- coversLOW_VOLATILITY_QUERY_KEYSgenerically, passes with the new keysnpm run test:unit-- 338 tests passnpm run typecheck-- cleanMade with Cursor