Send turbo-action on frame request headers #594
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main Purpose
Send Turbo-Action on frame request headers to have a way to know on controller if a Turbo frame is going to realise a "navigation" (not a navigation per se, just a browser URL update. I'll keep mentioning with double quotes for the sake of clarity)
Context
In some cases could be helpful on controllers to know if a frame request is going to update the browser URL when using
data-turbo-action
on the trigger. Let me explain myself with a real example:store_location_for
used on controllers to keep track of not logged users navigation and redirect them to the last location after a login/signup.data-turbo-action="advance"
and a lazy loaded turbo modal.turbo_frame_request?
helper, the user is redirected to A. But B is a valid page and when he clicked the button from A a "navigation" occurredThat's why I think this change could be useful to differentiate these cases. I understand that
turbo-action
was meant to be used just to know is pushState on browser history or not, but I think is better than to rely on it instead of using other values or creating a different field.Changes
Turbo-Action
on request headers along withTurbo-Frame
headermin.js
and source mapturbo_frame_with_navigation?
helper on FrameRequest (not 100% convinced with the name)