diff --git a/core/modules/layout_builder/src/Form/AddBlockForm.php b/core/modules/layout_builder/src/Form/AddBlockForm.php index 14d9646f9e..704d136ba9 100644 --- a/core/modules/layout_builder/src/Form/AddBlockForm.php +++ b/core/modules/layout_builder/src/Form/AddBlockForm.php @@ -47,8 +47,12 @@ protected function submitLabel() { * The form array. */ public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $plugin_id = NULL) { - $component = new SectionComponent($this->uuidGenerator->generate(), $region, ['id' => $plugin_id]); - $section_storage->getSection($delta)->appendComponent($component); + // Only generate a new component once per form submission. + if (!$component = $form_state->getTemporaryValue('layout_builder__component')) { + $component = new SectionComponent($this->uuidGenerator->generate(), $region, ['id' => $plugin_id]); + $section_storage->getSection($delta)->appendComponent($component); + $form_state->setTemporaryValue('layout_builder__component', $component); + } return $this->doBuildForm($form, $form_state, $section_storage, $delta, $component); }