diff --git a/apps/client/src/pages/builder/sidebars/left/sections/shared/section-dialog.tsx b/apps/client/src/pages/builder/sidebars/left/sections/shared/section-dialog.tsx index 6022afd2..7ad3f11e 100644 --- a/apps/client/src/pages/builder/sidebars/left/sections/shared/section-dialog.tsx +++ b/apps/client/src/pages/builder/sidebars/left/sections/shared/section-dialog.tsx @@ -31,6 +31,7 @@ type Props = { id: DialogName; form: UseFormReturn; defaultValues: T; + pendingKeyword?: string; children: React.ReactNode; }; @@ -38,6 +39,7 @@ export const SectionDialog = ({ id, form, defaultValues, + pendingKeyword, children, }: Props) => { const { isOpen, mode, close, payload } = useDialog(id); @@ -61,6 +63,9 @@ export const SectionDialog = ({ if (!section) return; if (isCreate || isDuplicate) { + if (pendingKeyword && values.keywords) { + values.keywords.push(pendingKeyword); + } setValue( `sections.${id}.items`, produce(section.items, (draft: T[]): void => { @@ -72,6 +77,10 @@ export const SectionDialog = ({ if (isUpdate) { if (!payload.item?.id) return; + if (pendingKeyword && values.keywords) { + values.keywords.push(pendingKeyword); + } + setValue( `sections.${id}.items`, produce(section.items, (draft: T[]): void => {