From 6b2be3ad5914a49d11fc515821d6e9314a3c620c Mon Sep 17 00:00:00 2001 From: gchust Date: Thu, 12 Mar 2026 16:09:21 +0800 Subject: [PATCH] fix: form draft not working correctly (#8858) --- .../plugin-form-drafts/src/client/plugin.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-form-drafts/src/client/plugin.tsx b/packages/plugins/@nocobase/plugin-form-drafts/src/client/plugin.tsx index 03aee48f072..826dfde1ec2 100644 --- a/packages/plugins/@nocobase/plugin-form-drafts/src/client/plugin.tsx +++ b/packages/plugins/@nocobase/plugin-form-drafts/src/client/plugin.tsx @@ -1,3 +1,12 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + import { FormBlockModel, Plugin } from '@nocobase/client'; import { FlowModelContext } from '@nocobase/flow-engine'; import { Alert, Button } from 'antd'; @@ -66,8 +75,7 @@ FormBlockModel.registerFlow({ await ctx.draftRepository.create(); return; } - const model = ctx.blockModel as FormBlockModel; - model.form.setFieldsValue(draft.values || {}); + await ctx.setFormValues(draft.values); ctx.showDraftAlert( 'This is an unsubmitted draft. You can continue editing and submit it, or click “Delete draft” to start over.', );