Skip to content

Commit

Permalink
Prevent double visits after a form submission redirect in the modal c…
Browse files Browse the repository at this point in the history
…ontext -> default context when the visit carries response.responseHTML
  • Loading branch information
jayohms committed Dec 16, 2024
1 parent 21313e4 commit 03e18df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/Turbo/Session/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,13 @@ extension Session: VisitableDelegate {
}

// Navigating forward - complete navigation early.
if visitable === currentVisit.visitable && currentVisit.state == .started {
completeNavigationForCurrentVisit()
return
if visitable === currentVisit.visitable {
let currentVisitCompletedWithResponse = currentVisit.options.response?.responseHTML != nil && currentVisit.state == .completed

if currentVisit.state == .started || currentVisitCompletedWithResponse {
completeNavigationForCurrentVisit()
return
}
}

// Navigating backward from a web view screen to a web view screen.
Expand Down

0 comments on commit 03e18df

Please sign in to comment.