File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/solid-router/src/ssr Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11import * as Solid from 'solid-js/web'
2+ import { makeSsrSerovalPlugin } from '@tanstack/router-core'
3+ import type { AnyRouter } from '@tanstack/router-core' ;
24import type { JSXElement } from 'solid-js'
3- import type { AnyRouter } from '@tanstack/router-core'
45
56export const renderRouterToString = async ( {
67 router,
@@ -12,9 +13,17 @@ export const renderRouterToString = async ({
1213 children : ( ) => JSXElement
1314} ) => {
1415 try {
16+
17+ const serializationAdapters = ( router . options as any ) ?. serializationAdapters || ( router . options . ssr as any ) ?. serializationAdapters
18+ const serovalPlugins = serializationAdapters ?. map ( ( adapter : any ) => {
19+ const plugin = makeSsrSerovalPlugin ( adapter , { didRun : false } )
20+ return plugin
21+ } )
22+
1523 let html = Solid . renderToString ( children , {
1624 nonce : router . options . ssr ?. nonce ,
17- } )
25+ plugins : serovalPlugins ,
26+ } as any )
1827 router . serverSsr ! . setRenderFinished ( )
1928 const injectedHtml = await Promise . all ( router . serverSsr ! . injectedHtml ) . then (
2029 ( htmls ) => htmls . join ( '' ) ,
You can’t perform that action at this time.
0 commit comments