-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't propose visit if the location is the same as the current visit #160
Conversation
This solves some blinking when there's a redirection to the current page.
I've tested this out in an example repository that utilizes Turbo 8 Morphs: https://github.com/seanpdoyle/turbo_native_bug_template/compare/morph-replace-bug Unfortunately, there's still some white flashes: Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-15.at.09.12.03.mp4After navigating backwards with a For the sake of keeping information in the same place, here is the diff: diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb
index 1b73960..9760e42 100644
--- a/app/views/application/index.html.erb
+++ b/app/views/application/index.html.erb
@@ -1 +1,18 @@
+<% content_for :head do %>
+ <style data-turbo-track="dynamic">
+ body {
+ background-color: red;
+ color: white;
+ }
+
+ a:visited {
+ color: white;
+ }
+ </style>
+<% end %>
+
<h1>application#index</h1>
+
+<a href="/" data-turbo-action="replace">[data-turbo-action="replace"]</a>
+
+<a href="/navigation">application#navigation</a>
diff --git a/app/views/application/navigation.html.erb b/app/views/application/navigation.html.erb
index 00c5e79..9d41149 100644
--- a/app/views/application/navigation.html.erb
+++ b/app/views/application/navigation.html.erb
@@ -1 +1,16 @@
+<% content_for :head do %>
+ <style data-turbo-track="dynamic">
+ body {
+ background-color: blue;
+ color: white;
+ }
+
+ a:visited {
+ color: white;
+ }
+ </style>
+<% end %>
+
<h1>application#navigation</h1>
+
+<a href="/navigation" data-turbo-action="replace">[data-turbo-action="replace"]</a>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index b199ce3..8a1e248 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -8,6 +8,9 @@
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
+
+ <%= yield :head %>
+ <% turbo_refreshes_with method: :morph, scroll: :preserve %>
</head>
<body>
diff --git a/ios/Demo.xcodeproj/project.pbxproj b/ios/Demo.xcodeproj/project.pbxproj
index 1927868..b97c4bc 100644
--- a/ios/Demo.xcodeproj/project.pbxproj
+++ b/ios/Demo.xcodeproj/project.pbxproj
@@ -476,7 +476,7 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/hotwired/strada-ios.git";
requirement = {
- branch = main;
+ branch = "skip-visit-proposal";
kind = branch;
};
}; |
@seanpdoyle did you happen to try this out with the Android implementation? I created a PR here hotwired/turbo-android#292 and didn't notice any further flashing issues, but maybe I was missing a scenario. |
Closed in favor of #178 |
Instead, reuse the same view. This avoids some blinking when there's a redirection to the current page.
BEFORE
BEFORE.mov
AFTER
AFTER.mov