next
Version:
The React Framework
31 lines (29 loc) • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "maybePostpone", {
enumerable: true,
get: function() {
return maybePostpone;
}
});
function maybePostpone(staticGenerationStore, reason) {
// If we aren't performing a static generation or we aren't using PPR then
// we don't need to postpone.
if (!staticGenerationStore.isStaticGeneration || !staticGenerationStore.experimental.ppr) {
return;
}
if (!staticGenerationStore.postpone) {
throw new Error("Invariant: PPR is enabled but the postpone API is unavailable");
}
// Keep track of if the postpone API has been called.
staticGenerationStore.postponeWasTriggered = true;
staticGenerationStore.postpone("This page needs to bail out of prerendering at this point because it used " + reason + ". " + "React throws this special object to indicate where. It should not be caught by " + "your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error");
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=maybe-postpone.js.map