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

feat: export PageSnapshot to allow for caching HTML strings #301

Merged
merged 1 commit into from Jul 5, 2021

Conversation

KonnorRogers
Copy link
Contributor

Why?

Currently im working on Mrujs, a modern ujs drop-in replacement thats fully client-side and has a built-in navigation adapter which leverages Turbo / Turbolinks. I have a working setup to prevent double navigation on successful form submissions that redirect with Turbolinks, however, I cant do the same with Turbo. This is because the code used to cache PageSnapshots is not exported. With the exported class, I can take advantage of caching a response body from a fetch request and then manually storing it in the cache and then trigger a "restore" visit through Turbo[links] so that it doesnt trigger double navigation and wipe away any flashes.

https://github.com/ParamagicDev/mrujs/blob/b21c2475dc56c635f3cd05c34bf2f1b971c97f3b/src/navigationAdapter.ts#L155-L157

^ Those are the lines of code dependent on the PageSnapshot class.

@dhh dhh merged commit 9babc80 into hotwired:main Jul 5, 2021
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.

None yet

3 participants