Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit ef38698

Browse files
authored
fix(core): fallback to using page's html render function when html is empty (#1680)
1 parent ca80d5f commit ef38698

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/libs/core/src/utils/renderUtils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,16 @@ export const renderPageToHtml = async (
4141
// Fallback to using renderReqToHtml without renderMode specified,
4242
// which will render html based on the page's renderReqToHtml,
4343
// which should always work (but adds another *warm* render cost)
44-
console.log("Falling back to using page's rendering function for html");
44+
console.log(
45+
"Exception occurred, falling back to using page's rendering function for html"
46+
);
47+
html = (await page.renderReqToHTML(req, res)) as unknown as string;
48+
}
49+
50+
if (!html || html === "") {
51+
console.log(
52+
"html is empty, falling back to using page's rendering function for html"
53+
);
4554
html = (await page.renderReqToHTML(req, res)) as unknown as string;
4655
}
4756

0 commit comments

Comments
 (0)