@tanstack/react-router
Advanced tools
Comparing version 1.43.1 to 1.43.2
@@ -20,2 +20,3 @@ import { Store, NoInfer } from '@tanstack/react-store'; | ||
matches: Array<any>; | ||
streamedValues: Record<string, any>; | ||
cleanScripts: () => void; | ||
@@ -357,2 +358,3 @@ dehydrated?: any; | ||
}) => any; | ||
serializer?: (data: any) => string; | ||
__store: Store<RouterState<TRouteTree>>; | ||
@@ -410,2 +412,5 @@ options: PickAsRequired<Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDehydrated, TSerializedError>, 'transformer'> & { | ||
hydrate: (__do_not_use_server_ctx?: string) => Promise<void>; | ||
injectedHtml: Array<string>; | ||
getStreamedValue: <T>(key: string) => T | undefined; | ||
streamValue: (key: string, value: any) => void; | ||
handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError) => void; | ||
@@ -412,0 +417,0 @@ hasNotFoundMatch: () => boolean; |
@@ -1216,4 +1216,3 @@ import { createBrowserHistory, createMemoryHistory } from "@tanstack/history"; | ||
this.state.location.search | ||
).map((match, i, allMatches) => { | ||
var _a2, _b2, _c2, _d, _e, _f; | ||
).map((match) => { | ||
const dehydratedMatch = dehydratedState.dehydratedMatches.find( | ||
@@ -1226,16 +1225,5 @@ (d) => d.id === match.id | ||
); | ||
const route = this.looseRoutesById[match.routeId]; | ||
const assets = dehydratedMatch.status === "notFound" || dehydratedMatch.status === "redirected" ? {} : { | ||
meta: (_b2 = (_a2 = route.options).meta) == null ? void 0 : _b2.call(_a2, { | ||
matches: allMatches, | ||
params: match.params, | ||
loaderData: dehydratedMatch.loaderData | ||
}), | ||
links: (_d = (_c2 = route.options).links) == null ? void 0 : _d.call(_c2), | ||
scripts: (_f = (_e = route.options).scripts) == null ? void 0 : _f.call(_e) | ||
}; | ||
return { | ||
...match, | ||
...dehydratedMatch, | ||
...assets | ||
...dehydratedMatch | ||
}; | ||
@@ -1251,2 +1239,18 @@ }); | ||
}; | ||
this.injectedHtml = []; | ||
this.getStreamedValue = (key) => { | ||
var _a; | ||
if (this.isServer) { | ||
return void 0; | ||
} | ||
return (_a = window.__TSR__) == null ? void 0 : _a.streamedValues[key]; | ||
}; | ||
this.streamValue = (key, value) => { | ||
var _a; | ||
const children = `window.__TSR__.streamedValues['${key}'] = ${(_a = this.serializer) == null ? void 0 : _a.call(this, value)}`; | ||
this.injectedHtml.push( | ||
`<script class='tsr-once'>${children}${process.env.NODE_ENV === "development" ? `; console.info(\`Injected From Server: | ||
${children}\`)` : ""}<\/script>` | ||
); | ||
}; | ||
this.handleNotFound = (matches, err) => { | ||
@@ -1253,0 +1257,0 @@ const matchesByRouteId = Object.fromEntries( |
@@ -19,3 +19,4 @@ import { jsx } from "react/jsx-runtime"; | ||
children, | ||
(log ?? true) && process.env.NODE_ENV === "development" ? `console.info('ScriptOnce', ${JSON.stringify(children)})` : "" | ||
(log ?? true) && process.env.NODE_ENV === "development" ? `console.info(\`Injected From Server: | ||
${children}\`)` : "" | ||
].filter(Boolean).join("\n") | ||
@@ -22,0 +23,0 @@ } |
{ | ||
"name": "@tanstack/react-router", | ||
"version": "1.43.1", | ||
"version": "1.43.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1370911
17009
10