Cache snapshot before doing page refresh #1188
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to fix issues related to white flickering and loading indicators on Turbo Native:
Previously, any
refresh
visit would exempt itself from the snapshot cache before issuing avisit(..., action: "replace")
. In a browser, this keeps the existing body in-place while refreshing the page and then performing morphing. The visit would havehasSnapshot: false
.In Turbo Native, when a visit is performed without a snapshot, a spinner will be shown and in some cases the WebView will be blanked as well while the page is fetched. This is especially painful when refresh stream actions are broadcasted, as the WebView will at random become unresponsible and/or flickr.
This PR changes so that a snapshot of the page is cached before issuing a refreshing visit. The cached snapshot will be of the recent state of the page and the native adapters will not blank the page while fetching the refreshed page.
I think it makes sense that page refreshes are storing the latest version of the page as a snapshot before refreshing; it is the most recent version of the content.