@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/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={!shouldShowNotFound() && childMatchId()}
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
- {(childMatchIdAccessor) => {
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={currentMatchId()} />}
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={currentMatchId()} />
505
+ <Match matchId={childMatchId()!} />
501
506
  </Solid.Suspense>
502
507
  </Solid.Show>
503
508
  )
@@ -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
- .filter((asset) => asset.tag === 'link')
121
- .map(
122
- (asset) =>
123
- ({
124
- tag: 'link',
125
- attrs: {
126
- ...asset.attrs,
127
- crossOrigin:
128
- getAssetCrossOrigin(assetCrossOrigin, 'stylesheet') ??
129
- asset.attrs?.crossOrigin,
130
- nonce,
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
- }) satisfies RouterManagedTag,
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
  })