Reproduction
https://stackblitz.com/edit/vitejs-vite-avh6zm6f?file=src%2Fcomponents%2FChildPage.vue,src%2Floaders%2FhomeLoader.ts
Steps to reproduce the bug
- Open reproduction link
- Open console, each loader has a
console.log statement at the top to see when each loader is executed.
- Verify that on initial load "parent-page" loader is called twice
- See that first loader is called twice
- Add breakpoint at
parentLoader
- Uncomment line in
ChildPage.vue.
- Refresh the preview
- See that parentLoader is called in infinite loop
Expected behavior
Each loader is only called once per navigation
Actual behavior
First loader is called twice. If line in child component is uncommented, first loader is called in infinite loop
Additional information
Setup includes a helper component that resolves a loader and provides slot with loaded data.
In my app, I have more than one child page, and so I've added simple caching to avoid refetching parent loader when navigating between them. This simple cache also persists when going back. If you remove caching and force it to reload every time, it will work as intended
Reproduction
https://stackblitz.com/edit/vitejs-vite-avh6zm6f?file=src%2Fcomponents%2FChildPage.vue,src%2Floaders%2FhomeLoader.ts
Steps to reproduce the bug
console.logstatement at the top to see when each loader is executed.parentLoaderChildPage.vue.Expected behavior
Each loader is only called once per navigation
Actual behavior
First loader is called twice. If line in child component is uncommented, first loader is called in infinite loop
Additional information
Setup includes a helper component that resolves a loader and provides slot with loaded data.
In my app, I have more than one child page, and so I've added simple caching to avoid refetching parent loader when navigating between them. This simple cache also persists when going back. If you remove caching and force it to reload every time, it will work as intended