Open awd opened 4 months ago
AppBridge does not reset the dirty state on forms submitted and updated via Rails turbo-frame
turbo-frame
data-save-bar
gem turbo-rails
The contextual-save-bar should reset once the turbo-frame has re-rendered the form.
Latest versions of Rails, Rails-Turbo, Hotwired/Turbo, Hotwired/Stimulus, AppBridge.
I've setup this simple Stimulus controller to work around the issue for now.
import { Controller } from '@hotwired/stimulus' export default class extends Controller { connect () { this.element.setAttribute('data-save-bar', '') } disconnect () { this.element.removeAttribute('data-save-bar') } }
edit.html.erb
<%= turbo_frame_tag('some_name_here') do %> <%= form_with(model: @model, url: model_path, html: { 'data-save-bar': '' }) do |form| %> <%= render partial: 'form', locals: { form: form } %> <% end %> <% end %>
update.turbo-stream.erb
<%= turbo_stream.update 'some_name_here' do %> <%= form_with(model: @model, url: model_path, html: { 'data-save-bar': '' }) do |form| %> <%= render partial: 'form', locals: { form: form } %> <% end %> <% end %>
We are looking into this issue.
Describe the bug
AppBridge does not reset the dirty state on forms submitted and updated via Rails
turbo-frame
To Reproduce
data-save-bar
attribute.gem turbo-rails
for theturbo-frame
element.Expected behaviour
The contextual-save-bar should reset once the turbo-frame has re-rendered the form.
Contextual information
Packages and versions
Latest versions of Rails, Rails-Turbo, Hotwired/Turbo, Hotwired/Stimulus, AppBridge.
Additional context
I've setup this simple Stimulus controller to work around the issue for now.
edit.html.erb
update.turbo-stream.erb