From 529380fb69a886a2d24136f69b9dba0eeb8f19fd Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 22 Jun 2022 14:10:30 +0800 Subject: [PATCH] fix(client): close the pop-up after request --- packages/core/client/src/block-provider/hooks/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 2da4085a0..a6cce5644 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -228,6 +228,7 @@ export const useCustomizeRequestActionProps = () => { const currentUserContext = useCurrentUserContext(); const currentUser = currentUserContext?.data?.data; const actionField = useField(); + const { visible, setVisible } = useActionContext(); return { async onClick() { @@ -236,7 +237,7 @@ export const useCustomizeRequestActionProps = () => { if (!requestSettings['url']) { return; } - if (skipValidator === false && xAction === 'customize:form:request') { + if (skipValidator !== true && xAction === 'customize:form:request') { await form.submit(); } @@ -263,12 +264,13 @@ export const useCustomizeRequestActionProps = () => { ...requestBody, }); actionField.data.loading = false; - - service?.refresh?.(); if (!(resource instanceof TableFieldResource)) { __parent?.service?.refresh?.(); } - + service?.refresh?.(); + if (xAction === 'customize:form:request') { + setVisible?.(false); + } if (!onSuccess?.successMessage) { return; }