-
Notifications
You must be signed in to change notification settings - Fork 436
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
data-turbo-action="advance" doesn't update browser URL #489
Comments
That feature was included in 7.1.0: https://github.com/hotwired/turbo/releases/tag/v7.1.0 |
when i manually update the src attribute of a frame with "data-turbo-action" set to "advance" the url doesn't change. I'm missing something ? When i click a link inside a frame everything is working as expected. |
Solved changing package.json to |
Are we sure this is working? I'm creating a fresh Rails 7 application, have included My view contains |
Same for me, I'm using |
May or not be related, but I'm experiencing a similar issue even without manually setting Turbo.visit(url, {
frame: 'my-frame',
}); Updates the |
For me, with Turbo 7.1.0, I see that it's working when navigating to other content within a turbo frame. When trying to combine it with I'll try updating to 7.3.0 to see if I can reproduce it there as well. Update: the problem persists with 7.3.0. Also, the "working" part above seems irregular to me:
However, if you do like this:
...it works as intended for me; history and URL is updated as it should be. |
@seanpdoyle - this is of course a bit premature, but it feels like this could be a limitation in the initial implementation in #398. 🤔 Would you like an isolated test case or could you give it a look regardless? To make things reasonably clear, we're talking about scenarios like this: <body>
<turbo-frame id="nav" target="content" data-turbo-action="advance">
<!-- Links inside this frame are broken; the data-turbo-action properly is not properly honored -->
<a href="/link-one">Link one</a>
<a href="/link-two">Link two</a>
</turbo-frame>
<turbo-frame id="content" data-turbo-action="advance">
<!-- Links inside this frame works correctly re. URL/history, with the limitations described in
earlier comment -->
<a href="/link-three">Link three</a>
</turbo-frame>
</body> |
After debugging it, I am seeing that |
I suspect this issue was introduced here, as before this change |
As a workaround, I added a controller to my rendered html that when connected passes values for the page name and path I want to set
|
I'd expect the following to update my URL but it doesn't :( |
@dhh @seanpdoyle this issue is regressed since 7.3.0, can we get this issue back open? |
Same. Would be really nice if that worked. |
I had this issue and upgrading to Rails 7.1.3 and Turbo 1.5 seemed to fix it for me. (I don't know which upgrade was responsible for the fix.) |
Closes [hotwired#489][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. [hotwired#489]: hotwired#489 [comment on hotwired#489]: hotwired#489 (comment)
I've opened #1135 to resolve this issue. |
I've added test coverage to #1135 to attempt to resolve this issue. Unfortunately, I was able to pass the test without any implementation changes. Could you review that diff (mainly https://github.com/hotwired/turbo/pull/1135/files#diff-1e84a1526802b27615a24efc0f9b75c27b2a9197d855a8ccc5475db14609ed6f and https://github.com/hotwired/turbo/pull/1135/files#diff-4706705ec52e666c36d3cd9410d3aad96354c69f61a18f880b40291836485f36R655-R663 to help me reproduce the underlying issue more closely? |
Closes [hotwired#489][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit makes one change to the public interface, and another to an internal interface. * `FrameElement.getElementById(id: string)` - unify the process to internally resolve a `<turbo-frame>` element by its `[id]`. Update call sites to use this new method * `FrameController.proposeVisitIfNavigatedWithAction(frame, elements = [], options = {})` - flatten the variable arguments into a single `Array`, then extend the interface to support Visit options like `{ action: }` [hotwired#489]: hotwired#489 [comment on hotwired#489]: hotwired#489 (comment)
Closes [hotwired#489][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit makes one change to the public interface, and another to an internal interface. * `FrameElement.getElementById(id: string)` - unify the process to internally resolve a `<turbo-frame>` element by its `[id]`. Update call sites to use this new method * `FrameController.proposeVisitIfNavigatedWithAction(frame, elements = [], options = {})` - flatten the variable arguments into a single `Array`, then extend the interface to support Visit options like `{ action: }` [hotwired#489]: hotwired#489 [comment on hotwired#489]: hotwired#489 (comment)
Closes [hotwired#489][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit makes one change to the public interface, and another to an internal interface. * `FrameElement.getElementById(id: string)` - unify the process to internally resolve a `<turbo-frame>` element by its `[id]`. Update call sites to use this new method * `FrameController.proposeVisitIfNavigatedWithAction(frame, elements = [], options = {})` - flatten the variable arguments into a single `Array`, then extend the interface to support Visit options like `{ action: }` [hotwired#489]: hotwired#489 [comment on hotwired#489]: hotwired#489 (comment)
Closes [hotwired#489][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit makes one change to the public interface, and another to an internal interface. * `FrameElement.getElementById(id: string)` - unify the process to internally resolve a `<turbo-frame>` element by its `[id]`. Update call sites to use this new method * `FrameController.proposeVisitIfNavigatedWithAction(frame, action)` - flatten the variable arguments into a single `action` argument. Move the `getVisitAction` call to the call sites that require it, and pass in the `action` directly when its available [hotwired#489]: hotwired#489 [comment on hotwired#489]: hotwired#489 (comment)
Closes [hotwired#489][] Closes [hotwired#468][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit makes one change to the public interface, and another to an internal interface. * `FrameElement.getElementById(id: string)` - unify the process to internally resolve a `<turbo-frame>` element by its `[id]`. Update call sites to use this new method * `FrameController.proposeVisitIfNavigatedWithAction(frame, action)` - flatten the variable arguments into a single `action` argument. Move the `getVisitAction` call to the call sites that require it, and pass in the `action` directly when its available [hotwired#489]: hotwired#489 [hotwired#468]: hotwired#468 [comment on hotwired#489]: hotwired#489 (comment)
Closes [hotwired#489][] Closes [hotwired#468][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit changes the `proposeVisitIfNavigatedWithAction(frame, action)` interface by flattening the variable arguments into a single `action` argument, then moving the `getVisitAction` call to the call sites that require it. The call sites that know their `action` pass it in directly when its available. [hotwired#489]: hotwired#489 [hotwired#468]: hotwired#468 [comment on hotwired#489]: hotwired#489 (comment)
Closes [hotwired#489][] Closes [hotwired#468][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on hotwired#489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit changes the `proposeVisitIfNavigatedWithAction(frame, action)` interface by flattening the variable arguments into a single `action` argument, then moving the `getVisitAction` call to the call sites that require it. The call sites that know their `action` pass it in directly when its available. [hotwired#489]: hotwired#489 [hotwired#468]: hotwired#468 [comment on hotwired#489]: hotwired#489 (comment)
Closes [#489][] Closes [#468][] First, add test coverage to exercise the `<turbo-frame id="frame">` and `<turbo-frame id="hello" target="frame">` as outlined in a [comment on #489][]. Next, add coverage to support driving a `<turbo-frame data-turbo-action="advance">` through the `Turbo.visit` method. To pass that test coverage, invoke `frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement)` prior to modifying the element's `[src]` attribute. To support the implementation changes necessary to pass the tests, this commit changes the `proposeVisitIfNavigatedWithAction(frame, action)` interface by flattening the variable arguments into a single `action` argument, then moving the `getVisitAction` call to the call sites that require it. The call sites that know their `action` pass it in directly when its available. [#489]: #489 [#468]: #468 [comment on #489]: #489 (comment)
The documentation says that the browser URL will be updated if
data-turbo-action="advance"
is set on a link or a turbo frame.Unfortunately, only the
src
attribute of the turbo frame is updated.When using
Turbo.visit()
, thesrc
attribute and the browser url are updated.I'm using version 7.0.1.
Is this related to #468?
The text was updated successfully, but these errors were encountered: