Skip to content

Commit

Permalink
feat(no-ssr): make digest configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Mar 4, 2024
1 parent 88e12fe commit ae5d7e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/no-ssr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const stlProp = Object.getOwnPropertyDescriptor(
const hasSTL = stlProp?.writable && typeof stlProp.value === 'number';

/** @private */
export const noSSRError = (errorMessage?: string) => {
export const noSSRError = (errorMessage?: string | undefined, nextjsDigest = 'BAILOUT_TO_CLIENT_SIDE_RENDERING') => {
const originalStackTraceLimit = Error.stackTraceLimit;

/**
Expand All @@ -30,7 +30,7 @@ export const noSSRError = (errorMessage?: string) => {

// Next.js marks errors with `NEXT_DYNAMIC_NO_SSR_CODE` digest as recoverable:
// https://github.com/vercel/next.js/blob/bef716ad031591bdf94058aaf4b8d842e75900b5/packages/next/src/shared/lib/lazy-dynamic/bailout-to-csr.ts#L2
(error as any).digest = 'BAILOUT_TO_CLIENT_SIDE_RENDERING';
(error as any).digest = nextjsDigest;

(error as any).recoverableError = 'NO_SSR';

Expand Down

0 comments on commit ae5d7e1

Please sign in to comment.