Skip to content

Commit

Permalink
fix(backoffice-vs): no longer closing ubos dialog after creating a ubo
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri-Levy committed Dec 28, 2024
1 parent ea0e639 commit 7ae2f0b
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ export const useManageUbosBlock = ({
});
const { formSchema, uiSchema } = createFormSchemaFromUIElements(translatedUbos ?? {});
const [isAddingUbo, _toggleIsAddingUbo, toggleOnIsAddingUbo, toggleOffIsAddingUbo] = useToggle();
const [isManageUbosOpen, toggleIsManageUbosOpen] = useToggle();
const { mutate: mutateCreateUbo } = useCreateUboMutation({
workflowId: workflow?.id,
onSuccess: toggleOffIsAddingUbo,
onSuccess: () => {
if (!isAddingUbo) {
return;
}

toggleOffIsAddingUbo();
},
});
const { mutate: mutateDeleteUbosByIds } = useDeleteUbosByIdsMutation({
workflowId: workflow?.id,
Expand Down Expand Up @@ -116,6 +123,7 @@ export const useManageUbosBlock = ({
<Dialog
trigger={
<Button
type={'button'}
variant={'ghost'}
size={'icon'}
className={'aria-disabled:pointer-events-none aria-disabled:opacity-50'}
Expand Down Expand Up @@ -200,8 +208,11 @@ export const useManageUbosBlock = ({
type: 'node',
value: (
<Dialog
open={isManageUbosOpen}
onOpenChange={toggleIsManageUbosOpen}
trigger={
<Button
type={'button'}
variant="outline"
className={
'ms-auto px-2 py-0 text-xs aria-disabled:pointer-events-none aria-disabled:opacity-50'
Expand Down Expand Up @@ -231,6 +242,7 @@ export const useManageUbosBlock = ({
/>
{create.enabled && (
<Button
type={'button'}
className={
'ms-auto aria-disabled:pointer-events-none aria-disabled:opacity-50'
}
Expand All @@ -245,6 +257,7 @@ export const useManageUbosBlock = ({
{create.enabled && isAddingUbo && (
<>
<Button
type={'button'}
variant={'ghost'}
onClick={toggleOffIsAddingUbo}
className={
Expand Down

0 comments on commit 7ae2f0b

Please sign in to comment.