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

Integrate [data-turbo-temporary] with pagehide event #1031

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanpdoyle
Copy link
Contributor

@seanpdoyle seanpdoyle commented Oct 11, 2023

Closes #1030

Add a pagehide listener to the CacheObserver class to listen for when the page has potential to enter the browser's Back-Forward Cache.

When the event is dispatched with the persisted set to true, remove all temporary elements.

Closes hotwired#1030

Add a [pagehide][] listener to the `CacheObserver` class to listen for
when the page has potential to enter the browser's [Back-Forward
Cache][bcfache].

When the event is dispatched with the [persisted][] set to `true`,
remove all temporary elements.

[pagehide]: https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event
[bfcache]: https://web.dev/articles/bfcache#observe_when_a_page_is_entering_bfcache
[persisted]: https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent/persisted
@seanpdoyle
Copy link
Contributor Author

The suite is passing for Chrome, but failing for Firefox. I'm not sure how to proceed.

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.

bfcache and data-turbo-temporary should work together
1 participant