Open seanpdoyle opened 8 months ago
In comparison, the @hotwired/turbo-android/demo gracefully handles the redirect:
Screen_recording_20240210_120001.webm
The following diff is the only necessary change to exhibit the desired behavior:
@@ -39,7 +39,8 @@ class MainSessionNavHostFragment : TurboSessionNavHostFragment() {
override val pathConfigurationLocation: TurboPathConfiguration.Location
get() = TurboPathConfiguration.Location(
- assetFilePath = "json/configuration.json"
+ assetFilePath = "json/configuration.json",
+ remoteFileUrl = "http://10.0.2.2/configurations/ios_v1.json"
)
override fun onSessionCreated() {
According to the path configuration file, the client handles
GET /navigations
requests with the "basic" stack, andGET /modal/new
requests with the "modal" stack.This commit modifies the
modals#new
action to redirect tonavigations#show
when the?redirect
query parameter is present.This
GET
toGET
redirect causes issues on the client, since at request-time, the client thinks its handling a "modal" navigation, but at response-time, the client is served a route that it'd handle as a "basic"` navigation.The resulting behavior is a bug through the following sequence:
navigations#show
responseOnce the navigation completes, the old root screen is entirely unavailable. There is no navigation "Back" button, gestures don't pop off the stack, and pull to refresh re-requests the
navigations#show
page.https://github.com/joemasilotti/TurboNavigator/assets/2575027/3aa14bb1-3c89-4a43-ad5c-9bcb4aa8e1da
The reproduction code is available at https://github.com/seanpdoyle/TurboNavigator/tree/redirect-get-modal-to-get-basic