@tanstack/solid-router 1.168.19 → 1.168.21
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/dist/cjs/Asset.cjs +13 -2
- package/dist/cjs/Asset.cjs.map +1 -1
- package/dist/cjs/Asset.d.cts +1 -1
- package/dist/cjs/Match.cjs +11 -5
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/headContentUtils.cjs +22 -7
- package/dist/cjs/headContentUtils.cjs.map +1 -1
- package/dist/esm/Asset.d.ts +1 -1
- package/dist/esm/Asset.js +13 -2
- package/dist/esm/Asset.js.map +1 -1
- package/dist/esm/Match.js +11 -5
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/headContentUtils.js +23 -8
- package/dist/esm/headContentUtils.js.map +1 -1
- package/dist/source/Asset.d.ts +1 -1
- package/dist/source/Asset.jsx +19 -1
- package/dist/source/Asset.jsx.map +1 -1
- package/dist/source/Match.jsx +12 -6
- package/dist/source/Match.jsx.map +1 -1
- package/dist/source/headContentUtils.jsx +33 -11
- package/dist/source/headContentUtils.jsx.map +1 -1
- package/package.json +2 -2
- package/src/Asset.tsx +36 -5
- package/src/Match.tsx +12 -7
- package/src/headContentUtils.tsx +36 -13
package/src/Match.tsx
CHANGED
|
@@ -469,13 +469,20 @@ export const Outlet = () => {
|
|
|
469
469
|
return router.stores.matchStores.get(id)?.get().status
|
|
470
470
|
})
|
|
471
471
|
|
|
472
|
-
// Only show not-found if we're not in a redirected state
|
|
473
472
|
const shouldShowNotFound = () =>
|
|
474
473
|
childMatchStatus() !== 'redirected' && parentGlobalNotFound()
|
|
475
474
|
|
|
475
|
+
const childRouteKey = Solid.createMemo(() => {
|
|
476
|
+
if (shouldShowNotFound()) return undefined
|
|
477
|
+
const cid = childMatchId()
|
|
478
|
+
if (!cid) return undefined
|
|
479
|
+
return router.stores.matchStores.get(cid)?.routeId ?? cid
|
|
480
|
+
})
|
|
481
|
+
|
|
476
482
|
return (
|
|
477
483
|
<Solid.Show
|
|
478
|
-
when={
|
|
484
|
+
when={childRouteKey()}
|
|
485
|
+
keyed
|
|
479
486
|
fallback={
|
|
480
487
|
<Solid.Show when={shouldShowNotFound() && route()}>
|
|
481
488
|
{(resolvedRoute) =>
|
|
@@ -484,20 +491,18 @@ export const Outlet = () => {
|
|
|
484
491
|
</Solid.Show>
|
|
485
492
|
}
|
|
486
493
|
>
|
|
487
|
-
{(
|
|
488
|
-
const currentMatchId = Solid.createMemo(() => childMatchIdAccessor())
|
|
489
|
-
|
|
494
|
+
{(_routeKey: string) => {
|
|
490
495
|
return (
|
|
491
496
|
<Solid.Show
|
|
492
497
|
when={routeId() === rootRouteId}
|
|
493
|
-
fallback={<Match matchId={
|
|
498
|
+
fallback={<Match matchId={childMatchId()!} />}
|
|
494
499
|
>
|
|
495
500
|
<Solid.Suspense
|
|
496
501
|
fallback={
|
|
497
502
|
<Dynamic component={router.options.defaultPendingComponent} />
|
|
498
503
|
}
|
|
499
504
|
>
|
|
500
|
-
<Match matchId={
|
|
505
|
+
<Match matchId={childMatchId()!} />
|
|
501
506
|
</Solid.Suspense>
|
|
502
507
|
</Solid.Show>
|
|
503
508
|
)
|
package/src/headContentUtils.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import * as Solid from 'solid-js'
|
|
|
2
2
|
import {
|
|
3
3
|
escapeHtml,
|
|
4
4
|
getAssetCrossOrigin,
|
|
5
|
+
isInlinableStylesheet,
|
|
5
6
|
replaceEqualDeep,
|
|
6
7
|
resolveManifestAssetLink,
|
|
7
8
|
} from '@tanstack/router-core'
|
|
@@ -117,20 +118,42 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
|
|
|
117
118
|
.map((match) => manifest?.routes[match.routeId]?.assets ?? [])
|
|
118
119
|
.filter(Boolean)
|
|
119
120
|
.flat(1)
|
|
120
|
-
.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
.flatMap((asset): Array<RouterManagedTag> => {
|
|
122
|
+
if (asset.tag === 'link') {
|
|
123
|
+
if (isInlinableStylesheet(manifest, asset)) {
|
|
124
|
+
return []
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return [
|
|
128
|
+
{
|
|
129
|
+
tag: 'link',
|
|
130
|
+
attrs: {
|
|
131
|
+
...asset.attrs,
|
|
132
|
+
crossOrigin:
|
|
133
|
+
getAssetCrossOrigin(assetCrossOrigin, 'stylesheet') ??
|
|
134
|
+
asset.attrs?.crossOrigin,
|
|
135
|
+
nonce,
|
|
136
|
+
},
|
|
131
137
|
},
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (asset.tag === 'style') {
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
tag: 'style',
|
|
145
|
+
attrs: {
|
|
146
|
+
...asset.attrs,
|
|
147
|
+
nonce,
|
|
148
|
+
},
|
|
149
|
+
children: asset.children,
|
|
150
|
+
...(asset.inlineCss ? { inlineCss: true as const } : {}),
|
|
151
|
+
},
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return []
|
|
156
|
+
})
|
|
134
157
|
|
|
135
158
|
return [...constructed, ...assets]
|
|
136
159
|
})
|