From d3bf9a7a4d63334889eb176577fcd3c9fc18909a Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 18 Oct 2023 11:56:57 +0800 Subject: [PATCH] fix(plugin-sequence): avoid invalid value from `ArrayTable.useRecord()` (#2859) --- .../plugin-sequence-field/src/client/sequence.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-sequence-field/src/client/sequence.tsx b/packages/plugins/@nocobase/plugin-sequence-field/src/client/sequence.tsx index 98256e8cc..a48c37612 100644 --- a/packages/plugins/@nocobase/plugin-sequence-field/src/client/sequence.tsx +++ b/packages/plugins/@nocobase/plugin-sequence-field/src/client/sequence.tsx @@ -40,9 +40,11 @@ function RuleTypeSelect(props) { } function RuleOptions() { - const { type, options } = ArrayTable.useRecord(); - const ruleType = RuleTypes[type]; const compile = useCompile(); + const { values } = useForm(); + const index = ArrayTable.useIndex(); + const { type, options } = values.patterns[index]; + const ruleType = RuleTypes[type]; return (
{ - form.setValuesIn(`patterns.${index}`, { type, options: { ...values } }); + setValuesIn(`patterns.${index}`, { type, options: { ...values } }); }) .catch((err) => { error(err);