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

Advance and replace actions do not update the session URL or call delegate methods #213

Open
adampal opened this issue May 23, 2024 · 2 comments

Comments

@adampal
Copy link

adampal commented May 23, 2024

Hey guys,
Thanks for all your amazing work on Turbo Native! We're running a turbo native app and have hit an issue when using the advance and replace actions.

When a turbo frame has data-turbo-action="advance" set, the navigation is promoted to a page visit and the URL in the browser is updated. However, the Session URL in Turbo Native is not updated.

This is causing an issue for us because we have a dashboard that displays various dates to the user. When the user navigates to a new date, we use a Turbo Frame to just change the relevant content. Because the URL is updated, if the user refreshes the page, they will see the latest date they viewed.

Because Turbo Native isn't updating the URL though, if the user refreshes the page, they go back to the last date that was loaded when they first launched the app.

It seems like there's also a change in v7.1.0 where now when a user navigates between two different tabs in the app, going back to the original tab triggers a new session request. This means if you navigate to a particular date in the dashboard tab, then swap to a different tab then back to the dashboard tab, the page flashes and you end up back on the initial dashboard date as opposed to the one you just navigated to.

The sessionDidStartRequest (and other related delegate methods) are not fired for an advance action either so there's no way to hook into the request and manually update the session URL from within the app.

For an advance and replace action given we're promoting them to full page navigations, it feels like we should be calling those delegate methods and updating the session's URL so we have consistent behaviour between the web and native versions of Turbo.

If this seems like behaviour we would want, I'm happy to try to put together a PR with the update.

@olliekav
Copy link

olliekav commented Jun 28, 2024

I'm running into this issue now when using a Turbo frame for page tabs.

@edooley
Copy link

edooley commented Aug 1, 2024

I believe this is related to my issue as well. We put our root tabs UI in a data-turbo-permanent so the app root is immune to cache refreshes. We change tabs via JS and use Turbo.navigator.history.replace to modify the url when tabs change. Turbo Native does not seem to honor this change though. Any progress or workarounds here?

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

No branches or pull requests

3 participants