Refactor initialisation of the formBuilder plugin to ensure two or more concurrent initialisations cannot interfere with each other #1459
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initialising two formBuilders concurrently would cause all but the last instance to be incorrectly initialised. Refactor this to using a initialisation function to isolate the plugin instance and store it in a data attribute for later use.
Additionally an uninitialised placeholder function has been put in place when actions are called before the formBuilder is initialised (when not using promise interface)
Both of these changes should reduce issue spam and also improve new developer experience by not having to load multi formBuilders in a recursive function or awaiting in a loop.
Tests have been added to check for concurrent loading, all existing tests pass after this change.
Closes: #1087
Closes: #1000
References: #965
References: #1088
References: #1340
References: #1383