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

Commit

Permalink
fix(core): fallback to using page's html render function when html is…
Browse files Browse the repository at this point in the history
… empty
  • Loading branch information
dphang committed Sep 13, 2021
1 parent d28e4d8 commit 2f8d7b5
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 2f8d7b5

Please sign in to comment.