From 7d94f59f9d55f2f1aa702e1f72478dca00a5c48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Fern=C3=A1ndez-Capel?= Date: Wed, 15 Nov 2023 14:08:26 +0000 Subject: [PATCH] Don't propose visit if the location is the same as the current visit This solves some blinking when there's a redirection to the current page. --- Source/WebView/turbo.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/WebView/turbo.js b/Source/WebView/turbo.js index 54508e5..9929305 100644 --- a/Source/WebView/turbo.js +++ b/Source/WebView/turbo.js @@ -57,7 +57,7 @@ } } } - + clearSnapshotCache() { if (window.Turbo) { Turbo.session.clearCache() @@ -103,6 +103,9 @@ if (Turbo.navigator.locationWithActionIsSamePage(location, options.action)) { Turbo.navigator.view.scrollToAnchorFromLocation(location) return + } else if (this.currentVisit?.location?.href === location.href) { + this.visitLocationWithOptionsAndRestorationIdentifier(location, options, Turbo.navigator.restorationIdentifier) + return } } @@ -146,7 +149,7 @@ visitCompleted(visit) { this.postMessage("visitCompleted", { identifier: visit.identifier, restorationIdentifier: visit.restorationIdentifier }) } - + formSubmissionStarted(formSubmission) { this.postMessage("formSubmissionStarted", { location: formSubmission.location.toString() }) }