Repository navigation
fix: use route watcher for recipe reload (#3484) - #3495
TheTisiboth wants to merge 2 commits into
Conversation
Replace onBeforeRouteUpdate guards with watch() on route ID in RecipeView and RecipeEdit. The watcher fires after the route updates, so routeId.value is fresh — fixes the stale route ID bug. Add regression tests verifying api.recipes.get receives the correct new ID on same-component navigation, plus unit tests for shouldReloadContent. Assisted-by: Claude_Code:claude-opus-4-6 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: Claude_Code:claude-opus-4-6 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e7c26b01-0793-4a94-adf8-13267d84c2a4
Files selected for processing: 5-
src/components/RecipeEdit.vuesrc/components/RecipeView/RecipeView.vuesrc/tests/helpers/mountWithRouter.jssrc/tests/setup/componentMocks.jssrc/tests/unit/routing/routeUpdateRecipeId.test.js
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
-
Topic and Scope
Fix stale route ID bug (#3484): after importing a recipe via URL, navigating to it showed a blank page because
onBeforeRouteUpdatereadrouteId.valuebefore the route had updated.Replace
onBeforeRouteUpdateguards withwatch()on the route ID in bothRecipeView.vueandRecipeEdit.vue. The watcher fires after the route updates, sorouteId.valueis always fresh. This follows the same pattern as #3381.Also adds regression tests verifying
api.recipes.getreceives the correct new ID on same-component navigation.Stacked on #3494 (Vitest migration). When that PR merges, this one auto-retargets to master.
Concerns/issues
The
shouldReloadContent()check that was inside the old guard is no longer needed — the watcher only fires when the route ID actually changes, which is exactly when a reload is needed.Formal requirements
AI-assistance
I used AI for code generation