Problem/Motivation
While working with content moderation and the paragraphs module. Having some paragraphs with untranslatable fields, and collapsing the paragraphs, after the ajax event we get a duplicated Fields that apply to all languages are hidden to avoid conflicting changes
over the paragraph field.
After an ajax action:
This also happens with just Drupal Core after saving a node:
The problem is that drupal_set_message() should not be used in form builders/alters as it's unpredictable when it runs.. An initial submit without an ajax action first results in the form being built again as does every form rebuild, typically done on ajax actions.
Proposed resolution
Convert the message to a render array.