@tanstack/router-core 1.162.9 → 1.163.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,7 +139,7 @@ class RouterCore {
139
139
  getInitialRouterState(this.latestLocation)
140
140
  );
141
141
  } else {
142
- this.__store = new store.Store(getInitialRouterState(this.latestLocation));
142
+ this.__store = store.createStore(getInitialRouterState(this.latestLocation));
143
143
  scrollRestoration.setupScrollRestoration(this);
144
144
  }
145
145
  }
@@ -731,8 +731,9 @@ class RouterCore {
731
731
  this.startTransition(() => {
732
732
  this.startViewTransition(async () => {
733
733
  let exitingMatches = [];
734
- let enteringMatches = [];
735
- let stayingMatches = [];
734
+ let hookExitingMatches = [];
735
+ let hookEnteringMatches = [];
736
+ let hookStayingMatches = [];
736
737
  batch.batch(() => {
737
738
  this.__store.setState((s) => {
738
739
  const previousMatches = s.matches;
@@ -740,11 +741,18 @@ class RouterCore {
740
741
  exitingMatches = previousMatches.filter(
741
742
  (match) => !newMatches.some((d) => d.id === match.id)
742
743
  );
743
- enteringMatches = newMatches.filter(
744
- (match) => !previousMatches.some((d) => d.id === match.id)
744
+ hookExitingMatches = previousMatches.filter(
745
+ (match) => !newMatches.some((d) => d.routeId === match.routeId)
745
746
  );
746
- stayingMatches = newMatches.filter(
747
- (match) => previousMatches.some((d) => d.id === match.id)
747
+ hookEnteringMatches = newMatches.filter(
748
+ (match) => !previousMatches.some(
749
+ (d) => d.routeId === match.routeId
750
+ )
751
+ );
752
+ hookStayingMatches = newMatches.filter(
753
+ (match) => previousMatches.some(
754
+ (d) => d.routeId === match.routeId
755
+ )
748
756
  );
749
757
  return {
750
758
  ...s,
@@ -769,9 +777,9 @@ class RouterCore {
769
777
  this.clearExpiredCache();
770
778
  });
771
779
  [
772
- [exitingMatches, "onLeave"],
773
- [enteringMatches, "onEnter"],
774
- [stayingMatches, "onStay"]
780
+ [hookExitingMatches, "onLeave"],
781
+ [hookEnteringMatches, "onEnter"],
782
+ [hookStayingMatches, "onStay"]
775
783
  ].forEach(([matches, hook]) => {
776
784
  matches.forEach((match) => {
777
785
  this.looseRoutesById[match.routeId].options[hook]?.(