@remix-run/router 1.21.0 → 1.21.1
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.
- package/CHANGELOG.md +7 -0
- package/dist/router.cjs.js +35 -17
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +33 -17
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +35 -17
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/router.ts +36 -16
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.21.
|
|
2
|
+
* @remix-run/router v1.21.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1660,6 +1660,13 @@ function createRouter(init) {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
1663
|
+
// Remove any lingering deleted fetchers that have already been removed
|
|
1664
|
+
// from state.fetchers
|
|
1665
|
+
deletedFetchers.forEach(key => {
|
|
1666
|
+
if (!state.fetchers.has(key) && !fetchControllers.has(key)) {
|
|
1667
|
+
deletedFetchersKeys.push(key);
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1663
1670
|
// Iterate over a local copy so that if flushSync is used and we end up
|
|
1664
1671
|
// removing and adding a new subscriber due to the useCallback dependencies,
|
|
1665
1672
|
// we don't get ourselves into a loop calling the new subscriber immediately
|
|
@@ -1672,6 +1679,10 @@ function createRouter(init) {
|
|
|
1672
1679
|
if (future.v7_fetcherPersist) {
|
|
1673
1680
|
completedFetchers.forEach(key => state.fetchers.delete(key));
|
|
1674
1681
|
deletedFetchersKeys.forEach(key => deleteFetcher(key));
|
|
1682
|
+
} else {
|
|
1683
|
+
// We already called deleteFetcher() on these, can remove them from this
|
|
1684
|
+
// Set now that we've handed the keys off to the data layer
|
|
1685
|
+
deletedFetchersKeys.forEach(key => deletedFetchers.delete(key));
|
|
1675
1686
|
}
|
|
1676
1687
|
}
|
|
1677
1688
|
// Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION
|
|
@@ -2863,13 +2874,11 @@ function createRouter(init) {
|
|
|
2863
2874
|
});
|
|
2864
2875
|
}
|
|
2865
2876
|
function getFetcher(key) {
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
deletedFetchers.delete(key);
|
|
2872
|
-
}
|
|
2877
|
+
activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);
|
|
2878
|
+
// If this fetcher was previously marked for deletion, unmark it since we
|
|
2879
|
+
// have a new instance
|
|
2880
|
+
if (deletedFetchers.has(key)) {
|
|
2881
|
+
deletedFetchers.delete(key);
|
|
2873
2882
|
}
|
|
2874
2883
|
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2875
2884
|
}
|
|
@@ -2884,21 +2893,28 @@ function createRouter(init) {
|
|
|
2884
2893
|
fetchLoadMatches.delete(key);
|
|
2885
2894
|
fetchReloadIds.delete(key);
|
|
2886
2895
|
fetchRedirectIds.delete(key);
|
|
2887
|
-
|
|
2896
|
+
// If we opted into the flag we can clear this now since we're calling
|
|
2897
|
+
// deleteFetcher() at the end of updateState() and we've already handed the
|
|
2898
|
+
// deleted fetcher keys off to the data layer.
|
|
2899
|
+
// If not, we're eagerly calling deleteFetcher() and we need to keep this
|
|
2900
|
+
// Set populated until the next updateState call, and we'll clear
|
|
2901
|
+
// `deletedFetchers` then
|
|
2902
|
+
if (future.v7_fetcherPersist) {
|
|
2903
|
+
deletedFetchers.delete(key);
|
|
2904
|
+
}
|
|
2888
2905
|
cancelledFetcherLoads.delete(key);
|
|
2889
2906
|
state.fetchers.delete(key);
|
|
2890
2907
|
}
|
|
2891
2908
|
function deleteFetcherAndUpdateState(key) {
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
activeFetchers.set(key, count);
|
|
2909
|
+
let count = (activeFetchers.get(key) || 0) - 1;
|
|
2910
|
+
if (count <= 0) {
|
|
2911
|
+
activeFetchers.delete(key);
|
|
2912
|
+
deletedFetchers.add(key);
|
|
2913
|
+
if (!future.v7_fetcherPersist) {
|
|
2914
|
+
deleteFetcher(key);
|
|
2899
2915
|
}
|
|
2900
2916
|
} else {
|
|
2901
|
-
|
|
2917
|
+
activeFetchers.set(key, count);
|
|
2902
2918
|
}
|
|
2903
2919
|
updateState({
|
|
2904
2920
|
fetchers: new Map(state.fetchers)
|