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

Page refreshes: Don't render previews #1098

Merged

Conversation

brunoprietog
Copy link
Collaborator

@brunoprietog brunoprietog commented Dec 4, 2023

Fixes #1080

In #1080, when rendering the cached snapshot as preview, idiomorph is causing document.body to become null, I didn't quite understand why.

Anyway, In my opinion morphing should not render previews anyway. If the goal of morphing is to maintain state, why would we want to do that and show a previous version of the document for a moment?

So, this PR does just that. If it is a page refresh, the cached snapshot will not be rendered as preview.

Fix Error when morphing a page when visiting it for the second time hotwired#1080
@brunoprietog brunoprietog force-pushed the morphing-do-not-render-previews branch from 0cfc08f to 875d739 Compare December 9, 2023 11:25
@brunoprietog brunoprietog changed the title Page refreshes: Don't render previews when morphing Page refreshes: Don't render previews Dec 9, 2023
@pfeiffer
Copy link
Contributor

pfeiffer commented Jan 30, 2024

I think this would be really useful and the way to go - right now a previous version of the document is shown for a brief period of time while the before the refreshed page is being morphed leading to some potential weird flickering and defeats the niceness of the refresh with morphing.

@afcapel
Copy link
Collaborator

afcapel commented Feb 1, 2024

Makes sense, thanks @brunoprietog 🙏

We excluded page refreshes from the cache on async updates, but forgot to do the same in regular navigations.

@afcapel afcapel merged commit 794d515 into hotwired:main Feb 1, 2024
1 check passed
@brunoprietog brunoprietog deleted the morphing-do-not-render-previews branch February 1, 2024 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Error when morphing a page when visiting it for the second time
3 participants