Skip to content
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

Changes in Presentation causes a full page refresh / white flicker #1915

Open
ragnsan opened this issue Nov 13, 2024 · 8 comments
Open

Changes in Presentation causes a full page refresh / white flicker #1915

ragnsan opened this issue Nov 13, 2024 · 8 comments

Comments

@ragnsan
Copy link

ragnsan commented Nov 13, 2024

If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.

Describe the bug

Making changes in Presentation causes a full refresh / white flicker of the content in the left-hand pane.

To Reproduce

Steps to reproduce the behavior:

Any document viewed in the Presentation pane.

Screenshots
If applicable, add screenshots to help explain your problem.

Which versions of Sanity are you using?

@sanity/cli (global) 3.28.0 (latest: 3.64.0)
@sanity/asset-utils 2.1.0 (up to date)
@sanity/color-input 4.0.1 (up to date)
@sanity/icons 3.4.0 (up to date)
@sanity/image-url 1.1.0 (up to date)
@sanity/preview-url-secret 2.0.3 (up to date)
@sanity/table 1.1.2 (up to date)
@sanity/ui 2.8.23 (up to date)
@sanity/vision 3.64.0 (up to date)
sanity 3.64.0 (up to date)
next-sanity 9.8.12

I was using next-sanity @ 9.8.10 and sanity @ 3.63.0 but I upgraded after seeing a similar issue on the official Sanity repo.

What operating system are you using?

MacOS

Which versions of Node.js / npm are you running?

10.2.4
v20.11.0

@rdunk
Copy link
Member

rdunk commented Nov 15, 2024

Would you be able to update your studio version to 3.64.1 and check if that fixes the issue for you?

@OignonFugace
Copy link

I’m currently using version 3.64.1, and I'm still experiencing the same issue.

@OignonFugace
Copy link

After some exploration, I’ve identified the behavior more clearly. I started by running:

rm -rf .next node_modules
npm cache clean --force
npm install
npm run build

Initially, this seemed to fix the issue — there were no full page reloads when making changes in the presentation tool. However, upon publishing a document, the page refreshes, and the issue with refreshes on every modification reappears.

I've found that closing the page, disabling draft mode, and reopening it temporarily resolves the issue, but as soon as I publish a document from the presentation mode, the full page refresh on each change returns.

It seems that any action that triggers a full page refresh once causes it to persist for every subsequent change. Publishing is one example, but even toggling the edit mode (using the switch in the top-left corner) and re-enabling it causes a refresh.

The only way I’ve found to restore the normal behavior is by exiting draft mode completely.

These tests were done using npm run start in Google Chrome.

@geeth24
Copy link

geeth24 commented Nov 20, 2024

having the same issue

@geeth24
Copy link

geeth24 commented Dec 6, 2024

I’m curious if there’s any news on this. It’s been quite frustrating, as it keeps refreshing and making it difficult to use.

@rdunk
Copy link
Member

rdunk commented Dec 10, 2024

More than happy to take a look at this if someone can provide a minimal reproduction, unfortunately I'm not able to replicate it from the information provided here.

@geeth24
Copy link

geeth24 commented Dec 14, 2024

I was able to resolve the issue by embedding my app layout within a () folder. Leaving the sanity outsided it. This prevents Sanity from refreshing itself unnecessarily.

https://nextjs.org/docs/app/building-your-application/routing/route-groups#organize-routes-without-affecting-the-url-path

@gadcam
Copy link

gadcam commented Feb 9, 2025

I had flickering issues too.
Adding a group like @geeth24 suggested (thank you :)) enabled me to add back

export const dynamic = 'force-static';

to the studio page and then it was solved.
It looks like the studio does not like if it is not renderer statically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants