Open jayohms opened 4 months ago
Looks great!
In the https://github.com/hotwired/turbo-ios/pull/181 I added a delegate method to deactivate the Visitable when the VisitableView did disappear; the thought was that we could end up with an active, but orphaned Visitable for the session, eg. when a modal is dismissed, it's WebView would still stay active, potentially receiving Turbo Streams etc. in the background, which feels off. We'd rather prepare the screenshot until next visit in that session.
Is there a similar need for such a thing in the Android library? TBH I'm not that familiar with the Turbo Android implementation, as we've primarily re-implemented most of it in the React Native Turbo library due to TurboSession marked as private.
There shouldn't be any similar concerns in the Android library, since the WebView
already gets properly detached/deactivated before navigating away from a Fragment
. And, the Android library does not use separate modal
vs default
sessions like iOS, so there aren't the same concerns there, either.
This is the Android counterpart to: https://github.com/hotwired/turbo-ios/pull/181
Prior to this PR it was possible that a snapshot was not cached for a given page when navigating away from a
WebView
screen. Replication steps:A
B
B
and navigate back to the native screenA
B
again. There was no snapshot cache available.This is due to the fact that, historically, snapshots were only cached by core
turbo.js
when navigating from web -> web screens. This resolves the issue by always caching a snapshot before navigating away from a web screen.