-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Prismic toolbar new tab refresh loop. #66
Comments
I have the same problem where my page gets stuck in a refresh loop right after hitting "Save" in Prismic. It happens when the page takes more than 3 seconds to load. (eg. Long time to first byte) Cause: prismic-toolbar/src/toolbar/preview/index.js Lines 44 to 48 in 94ef3d8
What happens is
Potential fix: I'm happy to submit a PR for this if you want. |
Or simpler, just call |
Is that what it was? Hmm, I think I may have had a different bug. Not sure
honestly - but that pr would go down a treat.
…On Tue, 6 Apr 2021, 16:43 Paul Nta, ***@***.***> wrote:
I have the same problem where my page gets stuck in a refresh loop right
after hitting "Save" in Prismic. It happens when the page takes more than 3
seconds to load. (eg. Long time to first byte)
*Cause:*
I think it's related to the following function updatePreview() which is called
every 3 seconds
<https://github.com/prismicio/prismic-toolbar/blob/94ef3d89cfcef8951b1bf12fc104afd22008e0b3/src/toolbar/preview/index.js#L32-L38>
:
https://github.com/prismicio/prismic-toolbar/blob/94ef3d89cfcef8951b1bf12fc104afd22008e0b3/src/toolbar/preview/index.js#L44-L48
What happens is
1. reloadOrigin() is called for the first time (after changes are made
on Prismic)
2. The page starts reloading...
3. After 3 seconds, reloadOrigin is called again. But this will
automatically cancel the previous reload.
4. The page starts reloading again
5. and so on...
*Potential fix:*
call reloadOrigin only if there is no other reload in progress.
I'm happy to submit a PR for this if you want.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD26U2G7ETVCUDIETQCJVJLTHMT2TANCNFSM4O4XDS3Q>
.
|
@danielhuggins If you see some request to your page with the status |
Hey @danielhuggins @paulnta, PR #97 should address the issue. It is pending a review. @danielhuggins - The fix in your PR has been included in #97. Thanks for that fix! 👍 |
PR #97 has been merged and deployed. The latest version of the toolbar, If you experience infinite refreshing please reply here or open a new issue. Thanks! 🙂 |
In certain situations, the prismic toolbar goes into a refresh loop.
Steps to reproduce.
This actually managed to take our server down from getting hammered by the refresh loop. (It was on a heavy data export page). Please fix it, as we are using a messy workaround in the meantime.
The text was updated successfully, but these errors were encountered: