@tanstack/react-router 0.0.1-beta.74 → 0.0.1-beta.76
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/build/cjs/index.js +12 -8
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +12 -8
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +57 -57
- package/build/types/index.d.ts +1 -1
- package/build/umd/index.development.js +31 -28
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +10 -13
package/build/stats-react.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "f796-109",
|
|
11
11
|
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"children": [
|
|
16
16
|
{
|
|
17
17
|
"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
18
|
-
"uid": "
|
|
18
|
+
"uid": "f796-111"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "f796-113"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
},
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"children": [
|
|
29
29
|
{
|
|
30
30
|
"name": "store/build/esm/index.js",
|
|
31
|
-
"uid": "
|
|
31
|
+
"uid": "f796-115"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "router/build/esm/index.js",
|
|
35
|
-
"uid": "
|
|
35
|
+
"uid": "f796-117"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"name": "react-store/build/esm/index.js",
|
|
39
|
-
"uid": "
|
|
39
|
+
"uid": "f796-119"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "react-router/src/index.tsx",
|
|
43
|
-
"uid": "
|
|
43
|
+
"uid": "f796-121"
|
|
44
44
|
}
|
|
45
45
|
]
|
|
46
46
|
}
|
|
@@ -50,176 +50,176 @@
|
|
|
50
50
|
"isRoot": true
|
|
51
51
|
},
|
|
52
52
|
"nodeParts": {
|
|
53
|
-
"
|
|
53
|
+
"f796-109": {
|
|
54
54
|
"renderedLength": 429,
|
|
55
55
|
"gzipLength": 238,
|
|
56
56
|
"brotliLength": 0,
|
|
57
|
-
"mainUid": "
|
|
57
|
+
"mainUid": "f796-108"
|
|
58
58
|
},
|
|
59
|
-
"
|
|
59
|
+
"f796-111": {
|
|
60
60
|
"renderedLength": 181,
|
|
61
61
|
"gzipLength": 129,
|
|
62
62
|
"brotliLength": 0,
|
|
63
|
-
"mainUid": "
|
|
63
|
+
"mainUid": "f796-110"
|
|
64
64
|
},
|
|
65
|
-
"
|
|
65
|
+
"f796-113": {
|
|
66
66
|
"renderedLength": 44,
|
|
67
67
|
"gzipLength": 62,
|
|
68
68
|
"brotliLength": 0,
|
|
69
|
-
"mainUid": "
|
|
69
|
+
"mainUid": "f796-112"
|
|
70
70
|
},
|
|
71
|
-
"
|
|
71
|
+
"f796-115": {
|
|
72
72
|
"renderedLength": 1288,
|
|
73
73
|
"gzipLength": 497,
|
|
74
74
|
"brotliLength": 0,
|
|
75
|
-
"mainUid": "
|
|
75
|
+
"mainUid": "f796-114"
|
|
76
76
|
},
|
|
77
|
-
"
|
|
78
|
-
"renderedLength":
|
|
79
|
-
"gzipLength":
|
|
77
|
+
"f796-117": {
|
|
78
|
+
"renderedLength": 46874,
|
|
79
|
+
"gzipLength": 11076,
|
|
80
80
|
"brotliLength": 0,
|
|
81
|
-
"mainUid": "
|
|
81
|
+
"mainUid": "f796-116"
|
|
82
82
|
},
|
|
83
|
-
"
|
|
83
|
+
"f796-119": {
|
|
84
84
|
"renderedLength": 1571,
|
|
85
85
|
"gzipLength": 594,
|
|
86
86
|
"brotliLength": 0,
|
|
87
|
-
"mainUid": "
|
|
87
|
+
"mainUid": "f796-118"
|
|
88
88
|
},
|
|
89
|
-
"
|
|
90
|
-
"renderedLength":
|
|
91
|
-
"gzipLength":
|
|
89
|
+
"f796-121": {
|
|
90
|
+
"renderedLength": 12591,
|
|
91
|
+
"gzipLength": 3262,
|
|
92
92
|
"brotliLength": 0,
|
|
93
|
-
"mainUid": "
|
|
93
|
+
"mainUid": "f796-120"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"nodeMetas": {
|
|
97
|
-
"
|
|
97
|
+
"f796-108": {
|
|
98
98
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
99
99
|
"moduleParts": {
|
|
100
|
-
"index.production.js": "
|
|
100
|
+
"index.production.js": "f796-109"
|
|
101
101
|
},
|
|
102
102
|
"imported": [],
|
|
103
103
|
"importedBy": [
|
|
104
104
|
{
|
|
105
|
-
"uid": "
|
|
105
|
+
"uid": "f796-120"
|
|
106
106
|
}
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
|
-
"
|
|
109
|
+
"f796-110": {
|
|
110
110
|
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
111
111
|
"moduleParts": {
|
|
112
|
-
"index.production.js": "
|
|
112
|
+
"index.production.js": "f796-111"
|
|
113
113
|
},
|
|
114
114
|
"imported": [],
|
|
115
115
|
"importedBy": [
|
|
116
116
|
{
|
|
117
|
-
"uid": "
|
|
117
|
+
"uid": "f796-116"
|
|
118
118
|
}
|
|
119
119
|
]
|
|
120
120
|
},
|
|
121
|
-
"
|
|
121
|
+
"f796-112": {
|
|
122
122
|
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
|
|
123
123
|
"moduleParts": {
|
|
124
|
-
"index.production.js": "
|
|
124
|
+
"index.production.js": "f796-113"
|
|
125
125
|
},
|
|
126
126
|
"imported": [],
|
|
127
127
|
"importedBy": [
|
|
128
128
|
{
|
|
129
|
-
"uid": "
|
|
129
|
+
"uid": "f796-116"
|
|
130
130
|
}
|
|
131
131
|
]
|
|
132
132
|
},
|
|
133
|
-
"
|
|
133
|
+
"f796-114": {
|
|
134
134
|
"id": "/packages/store/build/esm/index.js",
|
|
135
135
|
"moduleParts": {
|
|
136
|
-
"index.production.js": "
|
|
136
|
+
"index.production.js": "f796-115"
|
|
137
137
|
},
|
|
138
138
|
"imported": [],
|
|
139
139
|
"importedBy": [
|
|
140
140
|
{
|
|
141
|
-
"uid": "
|
|
141
|
+
"uid": "f796-116"
|
|
142
142
|
}
|
|
143
143
|
]
|
|
144
144
|
},
|
|
145
|
-
"
|
|
145
|
+
"f796-116": {
|
|
146
146
|
"id": "/packages/router/build/esm/index.js",
|
|
147
147
|
"moduleParts": {
|
|
148
|
-
"index.production.js": "
|
|
148
|
+
"index.production.js": "f796-117"
|
|
149
149
|
},
|
|
150
150
|
"imported": [
|
|
151
151
|
{
|
|
152
|
-
"uid": "
|
|
152
|
+
"uid": "f796-110"
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
|
-
"uid": "
|
|
155
|
+
"uid": "f796-112"
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
"uid": "
|
|
158
|
+
"uid": "f796-114"
|
|
159
159
|
}
|
|
160
160
|
],
|
|
161
161
|
"importedBy": [
|
|
162
162
|
{
|
|
163
|
-
"uid": "
|
|
163
|
+
"uid": "f796-120"
|
|
164
164
|
}
|
|
165
165
|
]
|
|
166
166
|
},
|
|
167
|
-
"
|
|
167
|
+
"f796-118": {
|
|
168
168
|
"id": "/packages/react-store/build/esm/index.js",
|
|
169
169
|
"moduleParts": {
|
|
170
|
-
"index.production.js": "
|
|
170
|
+
"index.production.js": "f796-119"
|
|
171
171
|
},
|
|
172
172
|
"imported": [
|
|
173
173
|
{
|
|
174
|
-
"uid": "
|
|
174
|
+
"uid": "f796-123"
|
|
175
175
|
}
|
|
176
176
|
],
|
|
177
177
|
"importedBy": [
|
|
178
178
|
{
|
|
179
|
-
"uid": "
|
|
179
|
+
"uid": "f796-120"
|
|
180
180
|
}
|
|
181
181
|
]
|
|
182
182
|
},
|
|
183
|
-
"
|
|
183
|
+
"f796-120": {
|
|
184
184
|
"id": "/packages/react-router/src/index.tsx",
|
|
185
185
|
"moduleParts": {
|
|
186
|
-
"index.production.js": "
|
|
186
|
+
"index.production.js": "f796-121"
|
|
187
187
|
},
|
|
188
188
|
"imported": [
|
|
189
189
|
{
|
|
190
|
-
"uid": "
|
|
190
|
+
"uid": "f796-108"
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
|
-
"uid": "
|
|
193
|
+
"uid": "f796-122"
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
"uid": "
|
|
196
|
+
"uid": "f796-116"
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
"uid": "
|
|
199
|
+
"uid": "f796-118"
|
|
200
200
|
}
|
|
201
201
|
],
|
|
202
202
|
"importedBy": [],
|
|
203
203
|
"isEntry": true
|
|
204
204
|
},
|
|
205
|
-
"
|
|
205
|
+
"f796-122": {
|
|
206
206
|
"id": "react",
|
|
207
207
|
"moduleParts": {},
|
|
208
208
|
"imported": [],
|
|
209
209
|
"importedBy": [
|
|
210
210
|
{
|
|
211
|
-
"uid": "
|
|
211
|
+
"uid": "f796-120"
|
|
212
212
|
}
|
|
213
213
|
],
|
|
214
214
|
"isExternal": true
|
|
215
215
|
},
|
|
216
|
-
"
|
|
216
|
+
"f796-123": {
|
|
217
217
|
"id": "use-sync-external-store/shim/with-selector",
|
|
218
218
|
"moduleParts": {},
|
|
219
219
|
"imported": [],
|
|
220
220
|
"importedBy": [
|
|
221
221
|
{
|
|
222
|
-
"uid": "
|
|
222
|
+
"uid": "f796-118"
|
|
223
223
|
}
|
|
224
224
|
],
|
|
225
225
|
"isExternal": true
|
package/build/types/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ type RouterProps<TRouteConfig extends AnyRootRoute = RootRoute, TRoutesInfo exte
|
|
|
79
79
|
};
|
|
80
80
|
declare function RouterProvider<TRouteConfig extends AnyRootRoute = RootRoute, TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo>({ router, ...rest }: RouterProps<TRouteConfig, TRoutesInfo>): JSX.Element;
|
|
81
81
|
declare function useRouterContext(): RegisteredRouter;
|
|
82
|
-
declare function useRouter<T = RouterStore>(track?: (state: Router['
|
|
82
|
+
declare function useRouter<T = RouterStore>(track?: (state: Router['__store']) => T, shallow?: boolean): RegisteredRouter;
|
|
83
83
|
declare function useMatches(): RouteMatch[];
|
|
84
84
|
declare function useMatch<TFrom extends keyof RegisteredRoutesInfo['routesById'], TStrict extends boolean = true, TRouteMatch = RouteMatch<RegisteredRoutesInfo, RegisteredRoutesInfo['routesById'][TFrom]>>(opts?: {
|
|
85
85
|
from: TFrom;
|
|
@@ -783,12 +783,12 @@
|
|
|
783
783
|
parseSearch: options?.parseSearch ?? defaultParseSearch,
|
|
784
784
|
fetchServerDataFn: options?.fetchServerDataFn ?? defaultFetchServerDataFn
|
|
785
785
|
};
|
|
786
|
-
this.
|
|
786
|
+
this.__store = new Store(getInitialRouterState(), {
|
|
787
787
|
onUpdate: state => {
|
|
788
788
|
this.state = state;
|
|
789
789
|
}
|
|
790
790
|
});
|
|
791
|
-
this.state = this.
|
|
791
|
+
this.state = this.__store.state;
|
|
792
792
|
this.basepath = '';
|
|
793
793
|
this.update(options);
|
|
794
794
|
|
|
@@ -808,7 +808,7 @@
|
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
reset = () => {
|
|
811
|
-
this.
|
|
811
|
+
this.__store.setState(s => Object.assign(s, getInitialRouterState()));
|
|
812
812
|
};
|
|
813
813
|
mount = () => {
|
|
814
814
|
// Mount only does anything on the client
|
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
}
|
|
829
829
|
this.history = this.options.history ?? (isServer ? createMemoryHistory() : createBrowserHistory());
|
|
830
830
|
const parsedLocation = this.#parseLocation();
|
|
831
|
-
this.
|
|
831
|
+
this.__store.setState(s => ({
|
|
832
832
|
...s,
|
|
833
833
|
latestLocation: parsedLocation,
|
|
834
834
|
currentLocation: parsedLocation
|
|
@@ -877,10 +877,10 @@
|
|
|
877
877
|
// Cancel any pending matches
|
|
878
878
|
this.cancelMatches();
|
|
879
879
|
let matches;
|
|
880
|
-
this.
|
|
880
|
+
this.__store.batch(() => {
|
|
881
881
|
if (opts?.next) {
|
|
882
882
|
// Ingest the new location
|
|
883
|
-
this.
|
|
883
|
+
this.__store.setState(s => ({
|
|
884
884
|
...s,
|
|
885
885
|
latestLocation: opts.next
|
|
886
886
|
}));
|
|
@@ -890,7 +890,7 @@
|
|
|
890
890
|
matches = this.matchRoutes(this.state.latestLocation.pathname, {
|
|
891
891
|
strictParseParams: true
|
|
892
892
|
});
|
|
893
|
-
this.
|
|
893
|
+
this.__store.setState(s => ({
|
|
894
894
|
...s,
|
|
895
895
|
status: 'pending',
|
|
896
896
|
pendingMatches: matches,
|
|
@@ -929,7 +929,7 @@
|
|
|
929
929
|
|
|
930
930
|
// Clear non-loading error states when match leaves
|
|
931
931
|
if (d.state.status === 'error') {
|
|
932
|
-
this.
|
|
932
|
+
this.__store.setState(s => ({
|
|
933
933
|
...s,
|
|
934
934
|
status: 'idle',
|
|
935
935
|
error: undefined
|
|
@@ -949,7 +949,7 @@
|
|
|
949
949
|
});
|
|
950
950
|
});
|
|
951
951
|
const prevLocation = this.state.currentLocation;
|
|
952
|
-
this.
|
|
952
|
+
this.__store.setState(s => ({
|
|
953
953
|
...s,
|
|
954
954
|
status: 'idle',
|
|
955
955
|
currentLocation: this.state.latestLocation,
|
|
@@ -1270,7 +1270,7 @@
|
|
|
1270
1270
|
};
|
|
1271
1271
|
};
|
|
1272
1272
|
hydrate = dehydratedRouter => {
|
|
1273
|
-
this.
|
|
1273
|
+
this.__store.setState(s => {
|
|
1274
1274
|
// Match the routes
|
|
1275
1275
|
const currentMatches = this.matchRoutes(dehydratedRouter.state.latestLocation.pathname, {
|
|
1276
1276
|
strictParseParams: true
|
|
@@ -1278,7 +1278,7 @@
|
|
|
1278
1278
|
currentMatches.forEach((match, index) => {
|
|
1279
1279
|
const dehydratedMatch = dehydratedRouter.state.currentMatches[index];
|
|
1280
1280
|
invariant(dehydratedMatch && dehydratedMatch.id === match.id, 'Oh no! There was a hydration mismatch when attempting to hydrate the state of the router! 😬');
|
|
1281
|
-
match.
|
|
1281
|
+
match.__store.setState(s => ({
|
|
1282
1282
|
...s,
|
|
1283
1283
|
...dehydratedMatch.state
|
|
1284
1284
|
}));
|
|
@@ -1464,7 +1464,6 @@
|
|
|
1464
1464
|
const componentTypes = ['component', 'errorComponent', 'pendingComponent'];
|
|
1465
1465
|
class RouteMatch {
|
|
1466
1466
|
abortController = new AbortController();
|
|
1467
|
-
onLoaderDataListeners = new Set();
|
|
1468
1467
|
constructor(router, route, opts) {
|
|
1469
1468
|
Object.assign(this, {
|
|
1470
1469
|
route,
|
|
@@ -1472,7 +1471,7 @@
|
|
|
1472
1471
|
id: opts.id,
|
|
1473
1472
|
pathname: opts.pathname,
|
|
1474
1473
|
params: opts.params,
|
|
1475
|
-
|
|
1474
|
+
__store: new Store({
|
|
1476
1475
|
updatedAt: 0,
|
|
1477
1476
|
routeSearch: {},
|
|
1478
1477
|
search: {},
|
|
@@ -1483,7 +1482,7 @@
|
|
|
1483
1482
|
}
|
|
1484
1483
|
})
|
|
1485
1484
|
});
|
|
1486
|
-
this.state = this.
|
|
1485
|
+
this.state = this.__store.state;
|
|
1487
1486
|
componentTypes.map(async type => {
|
|
1488
1487
|
const component = this.route.options[type];
|
|
1489
1488
|
if (typeof this[type] !== 'function') {
|
|
@@ -1491,7 +1490,7 @@
|
|
|
1491
1490
|
}
|
|
1492
1491
|
});
|
|
1493
1492
|
if (this.state.status === 'idle' && !this.#hasLoaders()) {
|
|
1494
|
-
this.
|
|
1493
|
+
this.__store.setState(s => ({
|
|
1495
1494
|
...s,
|
|
1496
1495
|
status: 'success'
|
|
1497
1496
|
}));
|
|
@@ -1511,7 +1510,7 @@
|
|
|
1511
1510
|
});
|
|
1512
1511
|
this.context = context;
|
|
1513
1512
|
this.routeContext = routeContext;
|
|
1514
|
-
this.
|
|
1513
|
+
this.__store.setState(s => ({
|
|
1515
1514
|
...s,
|
|
1516
1515
|
routeSearch: replaceEqualDeep(s.routeSearch, routeSearch),
|
|
1517
1516
|
search: replaceEqualDeep(s.search, search)
|
|
@@ -1582,7 +1581,7 @@
|
|
|
1582
1581
|
return;
|
|
1583
1582
|
}
|
|
1584
1583
|
this.route.options.onError?.(err);
|
|
1585
|
-
this.
|
|
1584
|
+
this.__store.setState(s => ({
|
|
1586
1585
|
...s,
|
|
1587
1586
|
status: 'error',
|
|
1588
1587
|
error: err
|
|
@@ -1616,7 +1615,7 @@
|
|
|
1616
1615
|
// to a loading state again. Otherwise, keep it
|
|
1617
1616
|
// as loading or resolved
|
|
1618
1617
|
if (this.state.status === 'idle') {
|
|
1619
|
-
this.
|
|
1618
|
+
this.__store.setState(s => ({
|
|
1620
1619
|
...s,
|
|
1621
1620
|
status: 'pending'
|
|
1622
1621
|
}));
|
|
@@ -1649,7 +1648,7 @@
|
|
|
1649
1648
|
try {
|
|
1650
1649
|
await Promise.all([componentsPromise, dataPromise]);
|
|
1651
1650
|
if (latestPromise = checkLatest()) return await latestPromise;
|
|
1652
|
-
this.
|
|
1651
|
+
this.__store.setState(s => ({
|
|
1653
1652
|
...s,
|
|
1654
1653
|
error: undefined,
|
|
1655
1654
|
status: 'success',
|
|
@@ -1662,7 +1661,7 @@
|
|
|
1662
1661
|
}
|
|
1663
1662
|
this.route.options.onLoadError?.(err);
|
|
1664
1663
|
this.route.options.onError?.(err);
|
|
1665
|
-
this.
|
|
1664
|
+
this.__store.setState(s => ({
|
|
1666
1665
|
...s,
|
|
1667
1666
|
error: err,
|
|
1668
1667
|
status: 'error',
|
|
@@ -1881,7 +1880,7 @@
|
|
|
1881
1880
|
...rest
|
|
1882
1881
|
}) {
|
|
1883
1882
|
router.update(rest);
|
|
1884
|
-
const currentMatches = useStore(router.
|
|
1883
|
+
const currentMatches = useStore(router.__store, s => s.currentMatches);
|
|
1885
1884
|
React__namespace.useEffect(router.mount, [router]);
|
|
1886
1885
|
return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
|
|
1887
1886
|
value: {
|
|
@@ -1899,12 +1898,12 @@
|
|
|
1899
1898
|
function useRouterContext() {
|
|
1900
1899
|
const value = React__namespace.useContext(routerContext);
|
|
1901
1900
|
warning(value, 'useRouter must be used inside a <Router> component!');
|
|
1902
|
-
useStore(value.router.
|
|
1901
|
+
useStore(value.router.__store);
|
|
1903
1902
|
return value.router;
|
|
1904
1903
|
}
|
|
1905
1904
|
function useRouter(track, shallow) {
|
|
1906
1905
|
const router = useRouterContext();
|
|
1907
|
-
useStore(router.
|
|
1906
|
+
useStore(router.__store, track, shallow);
|
|
1908
1907
|
return router;
|
|
1909
1908
|
}
|
|
1910
1909
|
function useMatches() {
|
|
@@ -1918,7 +1917,7 @@
|
|
|
1918
1917
|
if (opts?.strict ?? true) {
|
|
1919
1918
|
invariant(nearestMatch.route.id == match?.route.id, `useMatch("${match?.route.id}") is being called in a component that is meant to render the '${nearestMatch.route.id}' route. Did you mean to 'useMatch("${match?.route.id}", { strict: false })' or 'useRoute("${match?.route.id}")' instead?`);
|
|
1920
1919
|
}
|
|
1921
|
-
useStore(match.
|
|
1920
|
+
useStore(match.__store, d => opts?.track?.(match) ?? match, opts?.shallow);
|
|
1922
1921
|
return match;
|
|
1923
1922
|
}
|
|
1924
1923
|
function useRoute(routeId) {
|
|
@@ -1928,13 +1927,17 @@
|
|
|
1928
1927
|
return resolvedRoute;
|
|
1929
1928
|
}
|
|
1930
1929
|
function useSearch(opts) {
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1930
|
+
const {
|
|
1931
|
+
track,
|
|
1932
|
+
...matchOpts
|
|
1933
|
+
} = opts;
|
|
1934
|
+
const match = useMatch(matchOpts);
|
|
1935
|
+
useStore(match.__store, d => opts?.track?.(d.search) ?? d.search, true);
|
|
1933
1936
|
return match.state.search;
|
|
1934
1937
|
}
|
|
1935
1938
|
function useParams(opts) {
|
|
1936
1939
|
const router = useRouterContext();
|
|
1937
|
-
useStore(router.
|
|
1940
|
+
useStore(router.__store, d => {
|
|
1938
1941
|
const params = last(d.currentMatches)?.params;
|
|
1939
1942
|
return opts?.track?.(params) ?? params;
|
|
1940
1943
|
}, true);
|
|
@@ -1990,7 +1993,7 @@
|
|
|
1990
1993
|
match
|
|
1991
1994
|
}) {
|
|
1992
1995
|
const router = useRouterContext();
|
|
1993
|
-
useStore(match.
|
|
1996
|
+
useStore(match.__store, store => [store.status, store.error], true);
|
|
1994
1997
|
const defaultPending = React__namespace.useCallback(() => null, []);
|
|
1995
1998
|
const Inner = React__namespace.useCallback(props => {
|
|
1996
1999
|
if (props.match.state.status === 'error') {
|