Skip to content

Commit

Permalink
Group watch() together
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Aug 19, 2024
1 parent 6e85a3f commit 4838262
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,7 @@ const { setDisplayedRow } = inject(displayedRowKey) as unknown as {
};
const route = useRoute();
watch(
[
() => {
return { ...route };
},
],
([newRoute]) => {
navigate(newRoute);
},
);
const navigate = (newRoute: RouteLocationNormalizedLoadedGeneric) => {
switch (newRoute.name) {
case routeNames.splash:
Expand Down Expand Up @@ -130,6 +121,18 @@ const navigate = (newRoute: RouteLocationNormalizedLoadedGeneric) => {
}
};
// React to route changes.
watch(
[
() => {
return { ...route };
},
],
([newRoute]) => {
navigate(newRoute);
},
);
// Navigate on initial load of the tree.
watch(
tree,
Expand Down

0 comments on commit 4838262

Please sign in to comment.