diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx index cea063aa..f832ec7b 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx @@ -72,8 +72,6 @@ function EditorConstituenta({ activeID, onShowAST, onCreateCst, onRenameCst, onO setTextDefinition(activeCst.definition?.text?.raw ?? ''); setExpression(activeCst.definition?.formal ?? ''); setTypification(activeCst ? getCstTypificationLabel(activeCst) : 'N/A'); - } else if (schema && schema?.items.length > 0) { - onOpenEdit(schema.items[0].id); } }, [activeCst, onOpenEdit, schema]); diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx index ac2bb7b6..d25b1db3 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx @@ -163,6 +163,12 @@ function RSTabs() { while (activeIndex < schema.items.length && deleted.find(id => id === schema.items[activeIndex].id)) { ++activeIndex; } + if (activeIndex >= schema.items.length) { + activeIndex = schema.items.length - 1; + while (activeIndex >= 0 && deleted.find(id => id === schema.items[activeIndex].id)) { + --activeIndex; + } + } navigateTo(activeTab, schema.items[activeIndex].id); } if (afterDelete) afterDelete(deleted);