@molecule/app-routing-react-router 1.1.1 → 1.1.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.
- package/README.md +15 -8
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-26T04:27:24.124Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-routing-react-router
|
|
@@ -48,7 +48,9 @@ function App() {
|
|
|
48
48
|
|
|
49
49
|
A list with query-selected views. The public URL remains public after login;
|
|
50
50
|
a protected view waits for session restoration. Include the signed-in principal
|
|
51
|
-
in the data key so one user's cached response cannot appear for another user
|
|
51
|
+
in the data key so one user's cached response cannot appear for another user, and
|
|
52
|
+
pass `null` while the session is still restoring (`status === 'loading'`) — the
|
|
53
|
+
auth gate holds the request until then anyway, so waiting for it costs nothing.
|
|
52
54
|
|
|
53
55
|
```tsx
|
|
54
56
|
import { Link } from 'react-router'
|
|
@@ -76,7 +78,7 @@ function ActivityList() {
|
|
|
76
78
|
auth: { status, redirectTo: '/sign-in' },
|
|
77
79
|
})
|
|
78
80
|
const entries = useQuery(
|
|
79
|
-
list.canLoad
|
|
81
|
+
list.canLoad && status !== 'loading'
|
|
80
82
|
? {
|
|
81
83
|
key: ['activity', user?.id ?? 'anonymous', list.selection, list.filters, list.page],
|
|
82
84
|
fetch: async (signal) =>
|
|
@@ -727,7 +729,7 @@ function useIsActive(path: string, exact?: boolean): boolean
|
|
|
727
729
|
Hook to get a navigate function with molecule Router options.
|
|
728
730
|
|
|
729
731
|
```typescript
|
|
730
|
-
function useMoleculeNavigate():
|
|
732
|
+
function useMoleculeNavigate(): Router['navigate']
|
|
731
733
|
```
|
|
732
734
|
|
|
733
735
|
**Returns:** Navigate function
|
|
@@ -764,7 +766,7 @@ queries; changing filters or views resets the page atomically. Protected views w
|
|
|
764
766
|
auth and redirect only a confirmed signed-out session, with `state.returnTo` set.
|
|
765
767
|
|
|
766
768
|
```typescript
|
|
767
|
-
function useListRoute(
|
|
769
|
+
function useListRoute<Filter extends string = string, Selection extends string = string>(
|
|
768
770
|
options?: ListRouteOptions<Filter, Selection>,
|
|
769
771
|
): ListRouteResult<Filter, Selection>
|
|
770
772
|
```
|
|
@@ -804,7 +806,11 @@ function stringifyQuery(params: QueryParams): string
|
|
|
804
806
|
Matches a path pattern (with `:param` segments and `*` wildcards) against a pathname.
|
|
805
807
|
|
|
806
808
|
```typescript
|
|
807
|
-
function matchPath
|
|
809
|
+
function matchPath<Params extends RouteParams = RouteParams>(
|
|
810
|
+
pattern: string,
|
|
811
|
+
pathname: string,
|
|
812
|
+
exact?: boolean,
|
|
813
|
+
): RouteMatch<Params> | null
|
|
808
814
|
```
|
|
809
815
|
|
|
810
816
|
- `pattern` — The route pattern (e.g. `'/users/:id'`).
|
|
@@ -903,8 +909,9 @@ Peer dependencies:
|
|
|
903
909
|
Do not mirror selection/page in local state or rewrite an explicit public view
|
|
904
910
|
when auth changes. Auth redirects replace the protected history entry only after
|
|
905
911
|
a confirmed `unauthenticated` status; `loading` and `unavailable` remain in place.
|
|
906
|
-
- Pass `null` to `useQuery` when `list.canLoad` is false
|
|
907
|
-
|
|
912
|
+
- Pass `null` to `useQuery` when `list.canLoad` is false **or** while the session
|
|
913
|
+
is still restoring (`status === 'loading'`). Public views stay ready; protected
|
|
914
|
+
views do not fall back to a public request while auth is unresolved.
|
|
908
915
|
- A selection's `query` owns only its configured keys. `undefined` means absent;
|
|
909
916
|
unrelated query values and the hash survive pagination and selection changes.
|
|
910
917
|
Filter/selection changes reset page one atomically, unless `page` is explicit.
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
* @example
|
|
36
36
|
* A list with query-selected views. The public URL remains public after login;
|
|
37
37
|
* a protected view waits for session restoration. Include the signed-in principal
|
|
38
|
-
* in the data key so one user's cached response cannot appear for another user
|
|
38
|
+
* in the data key so one user's cached response cannot appear for another user, and
|
|
39
|
+
* pass `null` while the session is still restoring (`status === 'loading'`) — the
|
|
40
|
+
* auth gate holds the request until then anyway, so waiting for it costs nothing.
|
|
39
41
|
*
|
|
40
42
|
* ```tsx
|
|
41
43
|
* import { Link } from 'react-router'
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
* },
|
|
60
62
|
* auth: { status, redirectTo: '/sign-in' },
|
|
61
63
|
* })
|
|
62
|
-
* const entries = useQuery(list.canLoad ? {
|
|
64
|
+
* const entries = useQuery(list.canLoad && status !== 'loading' ? {
|
|
63
65
|
* key: ['activity', user?.id ?? 'anonymous', list.selection, list.filters, list.page],
|
|
64
66
|
* fetch: async (signal) => unwrapList<Entry>(await http.get('/api/activity', {
|
|
65
67
|
* signal,
|
|
@@ -116,8 +118,9 @@
|
|
|
116
118
|
* Do not mirror selection/page in local state or rewrite an explicit public view
|
|
117
119
|
* when auth changes. Auth redirects replace the protected history entry only after
|
|
118
120
|
* a confirmed `unauthenticated` status; `loading` and `unavailable` remain in place.
|
|
119
|
-
* - Pass `null` to `useQuery` when `list.canLoad` is false
|
|
120
|
-
*
|
|
121
|
+
* - Pass `null` to `useQuery` when `list.canLoad` is false **or** while the session
|
|
122
|
+
* is still restoring (`status === 'loading'`). Public views stay ready; protected
|
|
123
|
+
* views do not fall back to a public request while auth is unresolved.
|
|
121
124
|
* - A selection's `query` owns only its configured keys. `undefined` means absent;
|
|
122
125
|
* unrelated query values and the hash survive pagination and selection changes.
|
|
123
126
|
* Filter/selection changes reset page one atomically, unless `page` is explicit.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+IG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
* @example
|
|
36
36
|
* A list with query-selected views. The public URL remains public after login;
|
|
37
37
|
* a protected view waits for session restoration. Include the signed-in principal
|
|
38
|
-
* in the data key so one user's cached response cannot appear for another user
|
|
38
|
+
* in the data key so one user's cached response cannot appear for another user, and
|
|
39
|
+
* pass `null` while the session is still restoring (`status === 'loading'`) — the
|
|
40
|
+
* auth gate holds the request until then anyway, so waiting for it costs nothing.
|
|
39
41
|
*
|
|
40
42
|
* ```tsx
|
|
41
43
|
* import { Link } from 'react-router'
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
* },
|
|
60
62
|
* auth: { status, redirectTo: '/sign-in' },
|
|
61
63
|
* })
|
|
62
|
-
* const entries = useQuery(list.canLoad ? {
|
|
64
|
+
* const entries = useQuery(list.canLoad && status !== 'loading' ? {
|
|
63
65
|
* key: ['activity', user?.id ?? 'anonymous', list.selection, list.filters, list.page],
|
|
64
66
|
* fetch: async (signal) => unwrapList<Entry>(await http.get('/api/activity', {
|
|
65
67
|
* signal,
|
|
@@ -116,8 +118,9 @@
|
|
|
116
118
|
* Do not mirror selection/page in local state or rewrite an explicit public view
|
|
117
119
|
* when auth changes. Auth redirects replace the protected history entry only after
|
|
118
120
|
* a confirmed `unauthenticated` status; `loading` and `unavailable` remain in place.
|
|
119
|
-
* - Pass `null` to `useQuery` when `list.canLoad` is false
|
|
120
|
-
*
|
|
121
|
+
* - Pass `null` to `useQuery` when `list.canLoad` is false **or** while the session
|
|
122
|
+
* is still restoring (`status === 'loading'`). Public views stay ready; protected
|
|
123
|
+
* views do not fall back to a public request while auth is unresolved.
|
|
121
124
|
* - A selection's `query` owns only its configured keys. `undefined` means absent;
|
|
122
125
|
* unrelated query values and the hash survive pagination and selection changes.
|
|
123
126
|
* Filter/selection changes reset page one atomically, unless `page` is explicit.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+IG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-routing-react-router",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "React Router v7 provider for @molecule/app-routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"build": "tsc",
|
|
14
14
|
"dev": "tsc --watch",
|
|
15
15
|
"test": "vitest run",
|
|
16
|
-
"test:watch": "vitest"
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"typecheck:tests": "tsc -p tsconfig.tests.json"
|
|
17
18
|
},
|
|
18
19
|
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
19
20
|
"license": "Apache-2.0",
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"react-router": "^7.0.0 || ^8.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@molecule/app-i18n": "1.
|
|
31
|
+
"@molecule/app-i18n": "1.1.1",
|
|
31
32
|
"@types/node": "26.6.5",
|
|
32
33
|
"@types/react": "19.3.0",
|
|
33
34
|
"react": "19.3.1",
|