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

fix(core): fallback to using page's html render function when html is… #1680

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/libs/core/src/utils/renderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ export const renderPageToHtml = async (
// Fallback to using renderReqToHtml without renderMode specified,
// which will render html based on the page's renderReqToHtml,
// which should always work (but adds another *warm* render cost)
console.log("Falling back to using page's rendering function for html");
console.log(
"Exception occurred, falling back to using page's rendering function for html"
);
html = (await page.renderReqToHTML(req, res)) as unknown as string;
}

if (!html || html === "") {
console.log(
"html is empty, falling back to using page's rendering function for html"
);
html = (await page.renderReqToHTML(req, res)) as unknown as string;
}

Expand Down