Hello -- found a nasty (potentially costly) bug, curious if others can reproduce.
Problem:
When using the Preview mode and I navigate away from the preview path, the browser makes a flood of requests to my server host, preview api route (/preview) and the prismic subdomain for the project (/toolbar/predict & /toolbar/devMode).
I noticed this when seeing outlier spikes in my Vercel usage on days that we were creating and editing content.
Reproduction steps:
- In Chrome, go to the prismic dash and open a page type, click "Preview the page".
- Open network tab on Chrome browser.
- Navigate away from the page (e.g. from "/page" to root "/").
- Watch the insane number of requests being fired off.
Note: As soon as the "X" is clicked on the preview indicator, it stops.
My setup:
Nextjs 14 (pretty vanilla setup)
Using pages router.
In _app.tsx using <PrismicPreview repositoryName={repositoryName} />
@prismicio/next v1.5.0
Possible solution: Disable preview when user navigates away from intended preview page.