@tanstack/react-router 1.81.10 → 1.81.14
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/router.cjs +8 -4
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +3 -0
- package/dist/esm/router.d.ts +3 -0
- package/dist/esm/router.js +8 -4
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +14 -10
package/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -2933,7 +2933,7 @@ export class Router<
|
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
injectedHtml: Array<() => string> = []
|
|
2936
|
-
injectHtml
|
|
2936
|
+
injectHtml = (html: string) => {
|
|
2937
2937
|
const cb = () => {
|
|
2938
2938
|
this.injectedHtml = this.injectedHtml.filter((d) => d !== cb)
|
|
2939
2939
|
return html
|
|
@@ -2941,6 +2941,17 @@ export class Router<
|
|
|
2941
2941
|
|
|
2942
2942
|
this.injectedHtml.push(cb)
|
|
2943
2943
|
}
|
|
2944
|
+
injectScript = (script: string, opts?: { logScript?: boolean }) => {
|
|
2945
|
+
this.injectHtml(
|
|
2946
|
+
`<script class='tsr-once'>${script}${
|
|
2947
|
+
process.env.NODE_ENV === 'development' && (opts?.logScript ?? true)
|
|
2948
|
+
? `; console.info(\`Injected From Server:
|
|
2949
|
+
${script}\`)`
|
|
2950
|
+
: ''
|
|
2951
|
+
}; __TSR__.cleanScripts()</script>`,
|
|
2952
|
+
)
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2944
2955
|
streamedKeys: Set<string> = new Set()
|
|
2945
2956
|
|
|
2946
2957
|
getStreamedValue = <T>(key: string): T | undefined => {
|
|
@@ -2968,15 +2979,8 @@ export class Router<
|
|
|
2968
2979
|
)
|
|
2969
2980
|
|
|
2970
2981
|
this.streamedKeys.add(key)
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
this.injectHtml(
|
|
2974
|
-
`<script class='tsr-once'>${children}${
|
|
2975
|
-
process.env.NODE_ENV === 'development'
|
|
2976
|
-
? `; console.info(\`Injected From Server:
|
|
2977
|
-
${children}\`)`
|
|
2978
|
-
: ''
|
|
2979
|
-
}; __TSR__.cleanScripts()</script>`,
|
|
2982
|
+
this.injectScript(
|
|
2983
|
+
`__TSR__.streamedValues['${key}'] = { value: ${this.serializer?.(this.options.transformer.stringify(value))}}`,
|
|
2980
2984
|
)
|
|
2981
2985
|
}
|
|
2982
2986
|
|