Skip to content

Commit b84075c

Browse files
AyoubElkairhorns
authored andcommitted
update registerRenderable and render decorators to use RegisteredRenderable
1 parent 1e9637c commit b84075c

File tree

1 file changed

+4
-4
lines changed
  • packages/fastify-renderer/src/node

1 file changed

+4
-4
lines changed

packages/fastify-renderer/src/node/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
ViteDevServer,
1717
} from 'vite'
1818
import { DefaultDocumentTemplate } from './DocumentTemplate'
19-
import { FastifyRendererOptions, FastifyRendererPlugin } from './Plugin'
19+
import { FastifyRendererOptions, FastifyRendererPlugin, RegisteredRenderable } from './Plugin'
2020
import { PartialRenderOptions, Render, RenderableRoute, RenderOptions } from './renderers/Renderer'
2121
import { kRendererPlugin, kRendererViteOptions, kRenderOptions } from './symbols'
2222
import { wrap } from './tracing'
@@ -71,15 +71,15 @@ const FastifyRenderer = fp<FastifyRendererOptions>(
7171

7272
fastify.decorate('registerRenderable', function (this: FastifyInstance, renderable: string) {
7373
const renderableRoute: RenderableRoute = { ...this[kRenderOptions], renderable }
74-
plugin.registerRoute(renderableRoute)
74+
return plugin.registerRoute(renderableRoute)
7575
})
7676

77-
fastify.decorateReply('render', async function (this: FastifyReply, renderable: string, props: any) {
77+
fastify.decorateReply('render', async function (this: FastifyReply, token: RegisteredRenderable, props: any) {
7878
const request = this.request
7979
const renderableRoute: RenderableRoute = {
8080
...this.server[kRenderOptions],
8181
url: request.url,
82-
renderable,
82+
renderable: plugin.registeredComponents[token].renderable,
8383
isImperative: true,
8484
}
8585

0 commit comments

Comments
 (0)