-
Notifications
You must be signed in to change notification settings - Fork 478
Morphing not working on search form with the default advance action #1339
Description
Hi,
I was recently playing with morphing on a Rails application, specifically with a search form which made a GET request to the same index action of the page. I found that morphing was not working unless I defined the attribute data-turbo-action="replace" on the form element.
Going through the source code, I found that Turbo considers a page refresh only when the visit.action is replace.
turbo/src/core/drive/page_view.js
Line 59 in ea54ae5
| return !visit || (this.lastRenderedLocation.pathname === visit.location.pathname && visit.action === "replace") |
I was wondering if that made sense, since in the search request I was doing I may want to preserve the current location and push a new one so that I'm able to go back to previous searches, and that is not possible with the replace action.
This problem could also happen when applying filters on an index page as it would have the same form doing a GET request with the filter params to the same index action.
To give some context these were the versions I was working with:
rails-> 7.0.8turbo-rails-> 2.0.11