You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an existing createAsync call gets updated because of navigation, e.g. if its part of a CatchAll route, there is a somewhat random chance (probably based on timing) that the cache will return the results from the previous call even if the parameters differ. The example below makes it hopefully more clear 😅, you navigate to /about, but for some reason the cache function sometimes just returns /.
Add multiple links with urls targeting the CatchAll route
Implement a data function with cache, use server and 1 parameter, that just returns the parameter
Add a createAsync effect that calls the data function with e.g. location.pathname, output the result in the jsx
Reload the browser tab, click on a link
Repeat step 5. multiple times
Notice how the printed pathname sometimes differs from the actual path
Expected behavior
The cached function should always run with the newest arguments after hydration. For the example that means: when I navigate to /about I expect the cache function to be consistently called with /about
Screenshots or Videos
2024-07-27-23.35.05.8756812671.mp4
Platform
Browser: Chrome & Firefox
@solidjs/router: 0.14.1
solid-js: 1.8.18
@solidjs/start: 1.0.6
Additional context
Workaround: In the createAsync call, during the first rerun after hydration, run revalidate on the cache
Describe the bug
When an existing
createAsynccall gets updated because of navigation, e.g. if its part of a CatchAll route, there is a somewhat random chance (probably based on timing) that thecachewill return the results from the previous call even if the parameters differ. The example below makes it hopefully more clear 😅, you navigate to/about, but for some reason the cache function sometimes just returns/.Your Example Website or App
https://stackblitz.com/edit/github-xgtjzp?file=src%2Fcomponents%2FTest.tsx
Steps to Reproduce the Bug or Issue
cache,use serverand 1 parameter, that just returns the parametercreateAsynceffect that calls the data function with e.g.location.pathname, output the result in the jsxExpected behavior
The
cached function should always run with the newest arguments after hydration. For the example that means: when I navigate to/aboutI expect the cache function to be consistently called with/aboutScreenshots or Videos
2024-07-27-23.35.05.8756812671.mp4
Platform
Additional context
Workaround: In the
createAsynccall, during the first rerun after hydration, runrevalidateon thecache