You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
@prismicio/next requires specific configuration to work properly. For example, <PrismicPreview> must be set up with a properly created preview endpoint, and enableAutoPreviews() requires valid Next.js preview data or an API req object.
Some of this configuration can be analyzed statically to provide in-code-editor errors via TypeScript, but not everyone is using TypeScript, and some configuration can only be analyzed at runtime.
Without notifying developers of misconfiguration in an obvious way, developers likely may not understand errors caused as a result.
Describe the solution you'd like
The most obvious way to signal misconfiguration is crashing the Next.js process. If the server cannot start or build, a developer is more likely to fix the issue.
Alternatively, we can throw errors in the browser, prompting the Next.js error overlay to appear.
We can provide helpful messages and links to guide developers to properly set up their project.
Describe alternatives you've considered
Some errors are logged to the browser console, but they are not obvious. In some cases, such as <PrismicPreview>'s logic to start shared preview links, the page may refresh so quickly that console messages cannot be read.
angeloashmore
changed the title
Notify developers early if configuration is incorrect.
Notify developers early if configuration is incorrect
Jan 11, 2023
Is your feature request related to a problem? Please describe.
@prismicio/next
requires specific configuration to work properly. For example,<PrismicPreview>
must be set up with a properly created preview endpoint, andenableAutoPreviews()
requires valid Next.js preview data or an APIreq
object.Some of this configuration can be analyzed statically to provide in-code-editor errors via TypeScript, but not everyone is using TypeScript, and some configuration can only be analyzed at runtime.
Without notifying developers of misconfiguration in an obvious way, developers likely may not understand errors caused as a result.
Describe the solution you'd like
The most obvious way to signal misconfiguration is crashing the Next.js process. If the server cannot start or build, a developer is more likely to fix the issue.
Alternatively, we can throw errors in the browser, prompting the Next.js error overlay to appear.
We can provide helpful messages and links to guide developers to properly set up their project.
Describe alternatives you've considered
Some errors are logged to the browser console, but they are not obvious. In some cases, such as
<PrismicPreview>
's logic to start shared preview links, the page may refresh so quickly that console messages cannot be read.Additional context
Feature requested by @FuzzyReason
The text was updated successfully, but these errors were encountered: