Skip to content

Commit

Permalink
Fix frame not advancing when using Turbo.visit
Browse files Browse the repository at this point in the history
When you have a frame with `data-trubo-action` attribute and use
`Turbo.visit({frame: "frame-id"})` to navigate the frame the action is
ignored and the url does not change.

This appears to happen as the `visit` method of the frame does not set
the `action` on the `FrameController` as it does in the
`proposeVisitIfNavigatedWithAction`.

To fix this I've set the `action` property on the frame in the visit
method.
  • Loading branch information
pythonandchips committed Jul 6, 2023
1 parent 151aca2 commit 6915c54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/frames/frame_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ export class FrameController

private async visit(url: URL) {
const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams(), this.element)
if (this.element) {
this.action = getVisitAction(this.element)
}

this.currentFetchRequest?.cancel()
this.currentFetchRequest = request
Expand Down

0 comments on commit 6915c54

Please sign in to comment.