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
refactor(router-core): Verify changes are necessary before updating store (#4964)
Following #4916,
#4925,
#4926, and
#4928, this PR keeps reducing the
number of store updates (`__store.setState` through `updateMatch`).
We check the values we want to set in the store are *actually different*
from what is already in the store before calling `updateMatch`
---
In the `store-updates-during-navigation` test tracking the number of
executions of a `useRouterState > select` method during a navigation,
our main test case goes from **14 calls** without this PR, to **10
calls** with this PR. Most test cases show significant improvements as
well.
---
Should be a partial improvement of
#4359
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Prevented loss of previously loaded data during navigation when a
loader yields no value.
* Stabilized preloading to avoid redundant updates and unnecessary state
churn.
* Improved loading-state cleanup after navigation, reducing flicker and
inconsistent “fetching” indicators.
* **Performance**
* Reduced unnecessary state updates and re-renders during and after
preloads/loads for smoother navigation.
* **Tests**
* Updated async navigation tests to reflect refined timing and
data-return behavior and added a helper to simulate delayed async
results.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
0 commit comments