alibaba / formily

📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3
https://formilyjs.org/
MIT License
11.32k stars 1.48k forks source link

[Bug Report] 重置后$record和值的问题,感觉异步了? #4148

Open kikcmime opened 4 months ago

kikcmime commented 4 months ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  properties: {
    product: {
      type: 'string',
      title: '产品线',
      'x-decorator': 'FormItem',
      'x-component': 'ProductSelect',
      'x-component-props': {
        all: true,
        fieldNames: { label: 'cn_name', value: 'id' },
        onChange: () => {
          tableRef.current?.reload(true);
        },
      },
    },
    module: {
      type: 'array',
      title: '模块',
      'x-decorator': 'FormItem',
      'x-component': 'ModuleCascader2',
      'x-component-props': {
        fieldNames: { label: 'cn_name', value: 'id' },
        mode: 'multiple',

product: {{$record.product}} }, }, }

What is expected?

触发form的重置后为啥$record.product传给组件的值还是存在的或者说是上一次的值

What is actually happening?

重置后product传的希望是空

Package

@formily/reactive@2.3.1


kikcmime commented 4 months ago

properties: { product: { type: 'string', title: '产品线', 'x-decorator': 'FormItem', 'x-component': 'ProductSelect', 'x-component-props': { all: true, fieldNames: { label: 'cn_name', value: 'id' }, }, }, module: { type: 'array', title: '模块', 'x-decorator': 'FormItem', 'x-component': 'ModuleCascader2', 'x-component-props': { fieldNames: { label: 'cn_name', value: 'id' }, mode: 'multiple', product: {{$record.product}}, }, }, }