Skip to content

fix: use route watcher for recipe reload (#3484) - #3495

Open
TheTisiboth wants to merge 2 commits into
test/vitest-migrationfrom
fix/3484-route-watcher
Open

TheTisiboth wants to merge 2 commits into
test/vitest-migrationfrom
fix/3484-route-watcher

Conversation

@TheTisiboth

@TheTisiboth TheTisiboth commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Topic and Scope

Fix stale route ID bug (#3484): after importing a recipe via URL, navigating to it showed a blank page because onBeforeRouteUpdate read routeId.value before the route had updated.

Replace onBeforeRouteUpdate guards with watch() on the route ID in both RecipeView.vue and RecipeEdit.vue. The watcher fires after the route updates, so routeId.value is always fresh. This follows the same pattern as #3381.

Also adds regression tests verifying api.recipes.get receives 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

  • I did check that the app can still be opened and does not throw any browser logs
  • I created tests for newly added PHP code (check this if no PHP changes were made)
  • I updated the OpenAPI specs and added an entry to the API changelog (check if API was not modified)
  • I notified the matrix channel if I introduced an API change

AI-assistance

I used AI for code generation

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>
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   12 files  ±0    596 suites  ±0   2m 21s ⏱️ -1s
  594 tests ±0    586 ✅ ±0   8 💤 ±0  0 ❌ ±0 
2 376 runs  ±0  2 343 ✅ ±0  33 💤 ±0  0 ❌ ±0 

Results for commit 9d3e36e. ± Comparison against base commit 43114d8.

♻️ This comment has been updated with latest results.

@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Oct 24, 2026
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

RecipeEdit and RecipeView now watch route IDs instead of using onBeforeRouteUpdate handlers. RecipeEdit loads recipe data for a truthy ID and runs setup when the ID is absent. RecipeView runs setup when its ID changes. New test support mounts components with a memory router and provides component mocks. Routing tests check recipe fetches for the initial ID and after one or more navigations.

Priority: Normal

Merge Risk: Moderate · up to 9d3e3

Navigating between recipe edit URLs can silently discard unsaved edits. Overlapping loads can also show the wrong recipe in the editor. Add an update guard and a stale-response check before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "fix: use route watcher for recipe reload (#3484)" matches the main change. The PR replaces onBeforeRouteUpdate guards with a watch on the route ID in RecipeView.vue and RecipeEdit.vue, whic…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description includes the required Topic and Scope, Concerns/issues, and Formal requirements sections. It explains the bug, the implementation, the regression tests, the stacked PR dep…
Full details: Title check

Explanation

The title "fix: use route watcher for recipe reload (#3484)" matches the main change. The PR replaces onBeforeRouteUpdate guards with a watch on the route ID in RecipeView.vue and RecipeEdit.vue, which fixes a stale route ID bug when navigating to a recipe after importing it. The title is concise, specific, and uses a conventional commit prefix. The issue number in the title is a minor point and does not affect the assessment.

Full details: Description check

Explanation

The pull request description includes the required Topic and Scope, Concerns/issues, and Formal requirements sections. It explains the bug, the implementation, the regression tests, the stacked PR dependency, and the reported validation steps. All formal requirement checkboxes are addressed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TheTisiboth
TheTisiboth enabled stacked auto-merge (squash) October 24, 2026 22:39

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Commits

Reviewing files that changed from the base of the PR and between 43114d8 and 9d3e36e.

Files selected for processing: 5
  • src/components/RecipeEdit.vue
  • src/components/RecipeView/RecipeView.vue
  • src/tests/helpers/mountWithRouter.js
  • src/tests/setup/componentMocks.js
  • src/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.

Comment thread src/components/RecipeEdit.vue
Comment thread src/components/RecipeEdit.vue

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants