Skip to content
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

push_patch to same URL will perform a navigation and add to history stack #1510

Open
qq99 opened this issue Jan 3, 2025 · 3 comments
Open

Comments

@qq99
Copy link

qq99 commented Jan 3, 2025

Issue

ScreenRecording_01-03-2025.18-48-12_1.MP4

See the following screen recording, where when I click "Search" without changing my query, it sends a phx-event to this:

  @impl true
  def handle_event("search", %{"search" => query}, socket) do
    {:noreply, push_patch(socket, to: ~p"/search/#{query}")}
  end

This then shows up as another slide-from-right animation and swiping back brings me to the same page I was just at

Expectation

I don't see an animation and history stack remains unchanged since URL has not changed

@qq99
Copy link
Author

qq99 commented Jan 4, 2025

Actually on further investigation, it appears the web version does the same history push, I just didn't notice it before due to lack of animation / lack of pathologically spamming the button 😅

@qq99 qq99 closed this as completed Jan 4, 2025
@bcardarella bcardarella reopened this Jan 4, 2025
@bcardarella bcardarella transferred this issue from liveview-native/live_view_native Jan 4, 2025
@bcardarella
Copy link
Collaborator

bcardarella commented Jan 4, 2025

@carson-katri the issue here is the navigation animation. I don't know if this is avoidable or not in SwiftUI, but adding history in tihs way on the web doesn't result in any visual navigation in the browser. Using replace: true resolves that but now you lose history being added. Without it the history should still build with no navigation animation.

If that's not something that SwiftUI can do then we'll have to document this.

@bcardarella
Copy link
Collaborator

I will write up documentation that this shouldn't be handled in this way on native as it is a web-feature that doesn't make sense to preserve this history in the same way on native.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants