atlassian-labs / react-resource-router

Configuration driven routing solution for React SPAs that manages route matching, data fetching and progressive rendering
https://atlassian-labs.github.io/react-resource-router
Apache License 2.0
198 stars 28 forks source link

Rework prefetch to avoid updating store slices #178

Closed albertogasparin closed 1 year ago

albertogasparin commented 1 year ago

Current prefetch updates resources values directly, making them change state (eg going back to loading) if they are expired. That is problematic as might make current page blink if an expired resource is shared between current route and prefetched route. The solution is storing prefetched slices in a secondary map, and consuming them if available when the action (eg navigation) is confirmed.

Fixes #176