Merge pull request #7611 from tchak/fix-autosave
fix(autosave): morph instead of replace to preserve controller instances
This commit is contained in:
commit
14f67306fd
3 changed files with 2 additions and 3 deletions
|
@ -85,7 +85,6 @@ export class AutosaveStatusController extends ApplicationController {
|
|||
|
||||
private logError(error: ResponseError) {
|
||||
if (error && error.message) {
|
||||
error.message = `[Autosave] ${error.message}`;
|
||||
console.error(error);
|
||||
this.globalDispatch('sentry:capture-exception', error);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
= fields_for @champ.input_name, @champ do |form|
|
||||
= turbo_stream.replace @champ.input_group_id, partial: "shared/dossiers/editable_champs/editable_champ", locals: { champ: @champ, form: form }
|
||||
= turbo_stream.morph @champ.input_group_id, partial: "shared/dossiers/editable_champs/editable_champ", locals: { champ: @champ, form: form }
|
||||
|
||||
- if @champ.piece_justificative_file.attached?
|
||||
- attachment = @champ.piece_justificative_file.attachment
|
||||
|
|
|
@ -29,7 +29,7 @@ describe Champs::PieceJustificativeController, type: :controller do
|
|||
it 'renders the attachment template as Javascript' do
|
||||
subject
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).to include("action=\"replace\" target=\"#{champ.input_group_id}\"")
|
||||
expect(response.body).to include(""action":"morph","target":"#{champ.input_group_id}"")
|
||||
end
|
||||
|
||||
it 'updates dossier.last_champ_updated_at' do
|
||||
|
|
Loading…
Reference in a new issue