Skip to content

Commit 6f0b1d1

Browse files
committed
also add serialization plugins to renderRouterToString
1 parent fdb188c commit 6f0b1d1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/solid-router/src/ssr/renderRouterToString.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as Solid from 'solid-js/web'
2+
import { makeSsrSerovalPlugin } from '@tanstack/router-core'
3+
import type {AnyRouter} from '@tanstack/router-core';
24
import type { JSXElement } from 'solid-js'
3-
import type { AnyRouter } from '@tanstack/router-core'
45

56
export 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(''),

0 commit comments

Comments
 (0)