Skip to content

Page refreshes: Don't render previews#1098

Merged
afcapel merged 1 commit intohotwired:mainfrom
brunoprietog:morphing-do-not-render-previews
Feb 1, 2024
Merged

Page refreshes: Don't render previews#1098
afcapel merged 1 commit intohotwired:mainfrom
brunoprietog:morphing-do-not-render-previews

Conversation

@brunoprietog
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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