Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Morph remote turbo frames where the src attribute has changed
There are some cases when we don't want to reload a remote turbo frame on a page refresh. This may be because Turbo has added a src attribute to the turbo frame element, but we don't want to reload the frame from that URL. Form example, when a form inside a turbo frame is submitted, Turbo adds a src attribute to the form element. In those cases we don't want to reload the Turbo frame from the src URL. The src attribute points to the form submission URL, which may not be loadable with a GET request. Same thing can happen when a link inside a turbo frame is clicked. Turbo adds a src attribute to the frame element, but we don't want to reload the frame from that URL. If the src attribute of a turbo frame changes, this signals that the server wants to render something different that what's currently on the DOM, and Turbo should respect that. This also matches the progressive enhancement behavior philosophy of Turbo. The behaviour results in the Turbo frame that the server sends, which is what would happen anyway if there was no morphing involved, or on a first page load.
- Loading branch information