diff --git a/README.md b/README.md
index 06908d4..db0aee5 100644
--- a/README.md
+++ b/README.md
@@ -160,10 +160,8 @@ import { dangerHTML } from "brisa";
import { renderToString } from "brisa/server";
export const prerenderConfig = {
- render: (Component, props) => {
- return renderToString();
- },
- postRender: dangerHTML,
+ render: async (Component: any, props: any) =>
+ dangerHTML(await renderToString()),
};
export const plugin = prerenderMacroPlugin({
@@ -234,11 +232,12 @@ import { h } from "preact";
export const prerenderConfig = {
render: async (Component: any, props: any) => {
- return render();
+ return (
+
) }}
+ />
+ );
},
- postRender: (htmlString: string) => (
-
- ),
};
export const plugin = prerenderMacroPlugin({
diff --git a/examples-and-tests/brisa/config.tsx b/examples-and-tests/brisa/config.tsx
index 3cfd368..676d27f 100644
--- a/examples-and-tests/brisa/config.tsx
+++ b/examples-and-tests/brisa/config.tsx
@@ -3,6 +3,5 @@ import { renderToString } from "brisa/server";
export const prerenderConfig = {
render: async (Component: any, props: any) =>
- renderToString(),
- postRender: dangerHTML,
+ dangerHTML(await renderToString()),
};
diff --git a/examples-and-tests/preact/config.tsx b/examples-and-tests/preact/config.tsx
index 9834d21..5ad49be 100644
--- a/examples-and-tests/preact/config.tsx
+++ b/examples-and-tests/preact/config.tsx
@@ -3,9 +3,10 @@ import { h } from "preact";
export const prerenderConfig = {
render: async (Component: any, props: any) => {
- return render();
+ return (
+ ) }}
+ />
+ );
},
- postRender: (htmlString: string) => (
-
- ),
};
diff --git a/examples-and-tests/preact/plugin.test.tsx b/examples-and-tests/preact/plugin.test.tsx
index c50854c..86309f6 100644
--- a/examples-and-tests/preact/plugin.test.tsx
+++ b/examples-and-tests/preact/plugin.test.tsx
@@ -51,8 +51,7 @@ describe("Preact", () => {
children: [{type: "div",props: {
dangerouslySetInnerHTML: {__html: "Foo, foo!
"
}},
- __k: null,__: null,__b: 0,__e: null,__c: null,__v: 4,__i: -1,__u: 0},
- jsxDEV(Bar, {}, undefined, false, undefined, this)]}, undefined, true, undefined, this);
+ key: undefined,ref: undefined,__k: null,__: null,__b: 0,__e: null,__d: undefined,__c: null,constructor: undefined,__v: 4,__i: -1,__u: 0},jsxDEV(Bar, {}, undefined, false, undefined, this)]}, undefined, true, undefined, this);
}
`);
@@ -84,9 +83,7 @@ describe("Preact", () => {
type: "div",props: {dangerouslySetInnerHTML: {
__html: "Bar, bar!
"
}
- },
- __k: null,__: null,__b: 0,__e: null,__c: null,__v: 8,__i: -1,__u: 0}]
- }, undefined, true, undefined, this);
+ },key: undefined,ref: undefined,__k: null,__: null,__b: 0,__e: null,__d: undefined,__c: null,constructor: undefined,__v: 8,__i: -1,__u: 0}]}, undefined, true, undefined, this);
}
`);
@@ -106,7 +103,7 @@ describe("Preact", () => {
import {Bar} from "./components";
export default function Test() {
- return {type: "div",props: {dangerouslySetInnerHTML: {__html: "Bar, bar!
"}},__k: null,__: null,__b: 0,__e: null,__c: null,__v: 12,__i: -1,__u: 0};
+ return {type: "div",props: {dangerouslySetInnerHTML: {__html: "Bar, bar!
"}},key: undefined,ref: undefined,__k: null,__: null,__b: 0,__e: null,__d: undefined,__c: null,constructor: undefined,__v: 12,__i: -1,__u: 0};
}
`);
@@ -126,7 +123,7 @@ describe("Preact", () => {
import Foo from "./components";
export default function Test() {
- return {type: "div",props: {dangerouslySetInnerHTML: {__html: "Foo, Preact works!
"}},__k: null,__: null,__b: 0,__e: null,__c: null,__v: 16,__i: -1,__u: 0};
+ return {type: "div",props: {dangerouslySetInnerHTML: {__html: "Foo, Preact works!
"}},key: undefined,ref: undefined,__k: null,__: null,__b: 0,__e: null,__d: undefined,__c: null,constructor: undefined,__v: 16,__i: -1,__u: 0};
}
`);
diff --git a/package/prerender.tsx b/package/prerender.tsx
index 1a36978..150a75d 100644
--- a/package/prerender.tsx
+++ b/package/prerender.tsx
@@ -13,12 +13,7 @@ export async function prerender({
}: PrerenderParams) {
const Component = (await import(componentPath))[componentModuleName];
const config = (await import(prerenderConfigPath)).prerenderConfig;
- const htmlString = await config.render(Component, componentProps);
-
- const element = config.postRender(htmlString);
-
- // parse + stringify are used to avoid coercion to Bun's AST for $$typeof Symbol
- return JSON.parse(JSON.stringify(element));
+ return await config.render(Component, componentProps);
}
export function postRender(element: JSX.Element) {