diff --git a/admin-spa/src/components/VerticalTabForm.tsx b/admin-spa/src/components/VerticalTabForm.tsx index 274e32d..183e2b8 100644 --- a/admin-spa/src/components/VerticalTabForm.tsx +++ b/admin-spa/src/components/VerticalTabForm.tsx @@ -18,6 +18,13 @@ export function VerticalTabForm({ tabs, children, className }: VerticalTabFormPr const contentRef = useRef(null); const sectionRefs = useRef<{ [key: string]: HTMLElement }>({}); + // Update activeTab when tabs change (e.g., product type changes) + useEffect(() => { + if (tabs.length > 0 && !tabs.find(t => t.id === activeTab)) { + setActiveTab(tabs[0].id); + } + }, [tabs, activeTab]); + // Scroll spy - update active tab based on scroll position useEffect(() => { const handleScroll = () => {