chore(routing): update turbo stream only if champ used by routing rules has been updated

This commit is contained in:
Eric Leroy-Terquem 2024-06-14 10:52:33 +02:00
parent 78d1572c8f
commit e413c0881e
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
2 changed files with 3 additions and 3 deletions

View file

@ -559,7 +559,7 @@ module Users
if @dossier.champs.any?(&:changed_for_autosave?)
@dossier.last_champ_updated_at = Time.zone.now
if @dossier.champs_public.filter(&:changed_for_autosave?).any?(&:used_by_routing_rules?)
if @dossier.champs_public.any? { _1.changed_for_autosave? && _1.used_by_routing_rules? }
RoutingEngine.compute(@dossier)
end
end

View file

@ -5,5 +5,5 @@
= turbo_stream.append('contenu', render(Dossiers::InvalidIneligibiliteRulesComponent.new(dossier: @dossier)))
- else @ineligibilite_rules_is_computable
= turbo_stream.remove(dom_id(@dossier, :ineligibilite_rules_broken))
= turbo_stream.update "contact_information", partial: 'shared/dossiers/update_contact_information', locals: { dossier: @dossier, procedure: @procedure }
- if @dossier.champs.any? { _1.used_by_routing_rules? && params[:dossier][:champs_public_attributes].key?(_1.stable_id.to_s) }
= turbo_stream.update "contact_information", partial: 'shared/dossiers/update_contact_information', locals: { dossier: @dossier, procedure: @procedure }