Closed piyush-bhatt closed 2 months ago
The router is not caching the failed request, something else is. If you put a breakpoint into the navigation cycle, you will see that the router will try the function every time:
Thanks for pointing me in the right direction. After some debugging, it turns out that the issue was with the browser's caching behaviour for dynamic modules
Here is an open issue for anyone who faces the same problem, with cache-busting as a workaround
Reproduction
https://codesandbox.io/p/sandbox/async-cookies-dgnrgh
Steps to reproduce the bug
Foo
in the list. It should trigger a network call and navigate to/foo
on success withFoo
displayed on the pageBar
. It should trigger a network call but fail to navigate to/bar
as the network call should failBar
againExpected behavior
Since the initial request to fetch
Bar
had failed, the component for route shouldn't be cached and a network request should be triggered again to fetch the component.The component should only be cached on a successful fetch.
Actual behavior
A network call to fetch component
Bar
is not triggered again since the initial request to fetchBar
had failed and hence the content for the route/bar
can't be displayed anymore without refreshing the whole appvue-router documentation states the following
But it seems that the component is cached even on a failed fetch.
Additional information
No response