We've found an issue around how snapshots are being taken when navigating between separate sessions. When navigating between view controllers not belonging to the same session, snapshots are not taken and potentially stale snapshots are being shown.
The most simple example of this issue is actually in the demo app. Adding a delay to the /new action (shown modally) as well as showing a random number highlights the issue. The steps are:
Open the modal demo page (this will use Modal session)
Dismiss the modal
Open the modal demo page - no snapshots are shown, even though the page could already have been snapshotted
Dismiss the modal
Open the modal demo page again - snapshot is now shown, but snapshot is of the page made in step 1, not the latest
What we see here is that opening the modal the second time, still shows a spinner, even though the page has already been loaded and a potential snapshot could have been made when dismissing the modal. Opening it the third time actually does use a snapshot, but the snapshot is of the first visit to the modal, and thus potentially stale.
Since the WebView of the modal session is kept around, I'm wondering if we could somehow signal to the WebView that it's VisitableViewController is being dismissed so that a snapshot could be made?
We've found an issue around how snapshots are being taken when navigating between separate sessions. When navigating between view controllers not belonging to the same session, snapshots are not taken and potentially stale snapshots are being shown.
The most simple example of this issue is actually in the demo app. Adding a delay to the
/new
action (shown modally) as well as showing a random number highlights the issue. The steps are:Modal
session)https://github.com/hotwired/turbo-ios/assets/195925/950f1db1-11ae-42c0-b56f-c0a57ec913da
What we see here is that opening the modal the second time, still shows a spinner, even though the page has already been loaded and a potential snapshot could have been made when dismissing the modal. Opening it the third time actually does use a snapshot, but the snapshot is of the first visit to the modal, and thus potentially stale.
Since the WebView of the modal session is kept around, I'm wondering if we could somehow signal to the WebView that it's VisitableViewController is being dismissed so that a snapshot could be made?