Fix #3381 does not fix #3343: watch() returns the ref, not the value, so setup() never re-runs
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start in src/components/SearchResults.vue and inspect the routingDefinition watcher, then review src/router/index.ts to understand how category and tag route changes reuse the component. Reproduce the navigation from category A to category B without reloading, and verify that the displayed recipes update to the selected category.
Written by the indexing model from the issue text.
Description
Description
PR #3381 closed #3343, but the watcher it introduced can never fire. The symptom
of #3343 ("category/tag navigation shows the previously selected category")
is therefore still reproducible on current master.
Root cause
src/components/SearchResults.vue:
const routingDefinition = computed(() => ({
value: route.params.value,
type: props.query,
}));
watch(
() => routingDefinition,
(newValue, oldValue) => {
setup();
},
{
deep: true,
},
);
The watch source is a getter function, so watch calls it and uses the
return value as the watched value. Here that return value is the
ComputedRef object itself, not routingDefinition.value. Three consequences:
- The returned ref object is a constant reference and is never replaced, so
hasChanged(newValue, oldValue)is alwaysfalseand the callback never runs. - The getter body never reads
route.params.valueorprops.query, so no
reactive dependency is tracked at all.deep: truedoes not help — it only
affects traversal of the values passed to the callback, not whether the
effect re-runs. setup()is therefore only ever called fromonMounted.
Since /category/:value and /tags/:value reuse the same Search component
instance (src/router/index.ts), the component is not re-mounted on a param
change and the list keeps showing the previously loaded category.
Suggested fix
Pass the computed ref directly, so Vue tracks the dependencies evaluated inside
it:
watch(
- () => routingDefinition,
+ routingDefinition,
(newValue, oldValue) => {
setup();
},
- {
- deep: true,
- },
);
deep: true is no longer required: the computed returns a fresh object
whenever route.params.value changes, which is a change Vue detects without
deep traversal.
An alternative that also works, and avoids reading the parameter from a
reactive route inside the guard, is to pass the target route into setup():
const setup = async (r = route) => { /* const cat = r.params.value; ... */ };
onBeforeRouteUpdate((to, from, next) => {
next();
setup(to);
});
Note that onBeforeRouteUpdate is currently still imported in this file but
unused, so the first option keeps the diff minimal.
Reproduction
- Open Cookbook, click category A in the left navigation → list shows A.
- Click category B → list still shows the recipes of A, URL reads
#/category/B. - Press F5 → B is shown.
Expected behavior
The list shows the recipes of the category just clicked.
Actual behavior
The list lags one navigation behind; a reload is required.
Versions
Nextcloud server: see reporter's setup
Cookbook: 0.11.10 and current master (PR #3381, merged 2026-09-25)
- Dominant language
- HTML
- Stars
- 642
- Forks
- 113
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 47
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/cookbook
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
github_actions maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
All issues in nextcloud/cookbook
Similar issues
-
feature task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RealDevSquad/website-www#1178 ·
-
priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PedestrianDynamics/pyFDS-Evac#338 ·
Maintainers usually reply within 1 day
-
accessibility bug revealjs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14961 ·
Maintainers usually reply within 1 day
-
[Simple] NavigationBar primary commands do not render AppBarButton.Content when it is a UIElementOpencontrol/navigationbar kind/bug triage/untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
unoplatform/uno.toolkit.ui#1652 ·
Maintainers usually reply within 1 day