You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the "CodeSandbox Preview Console" or the "Browser DevTools Console". 打開 CodeSandbox 或是瀏覽器的開發人員工具
Click the "Set Form Fields" button on the webpage. 點擊網頁中的「Set Form Fields」按鈕
Check the warning log in the console. 於 Console(控制台)中查看警告 log(日誌訊息)
Possible causes 可能造成的原因
Both errors and warnings point to EMPTY_ERRORS, causing isEqual to perform a deepEqual comparison, determining that warnings and the errors already existing in refSet have the same reference.
importForm,{Field}from"rc-field-form";constInput=({ value ="", ...props})=><input{...props}value={value}/>;functionApp(){const[form]=Form.useForm<{username: string}>();constsetFormFields=()=>{// Warning: Warning: There may be circular references// https://github.com/react-component/util/blob/871c2c146b1050e33091005b32b8debcdcd15ca7/src/isEqual.ts#L14form.setFields([{name: "username",errors: []}]);};return(<Formform={form}><Fieldname="username"rules={[{required: true}]}onMetaChange={()=>{}}><Input/></Field><buttononClick={setFormFields}>Set Form Fields</button></Form>);}exportdefaultApp;
form.setFields
會導致警告「Warning: There may be circular references」How to reproduce 如何重現
Possible causes 可能造成的原因
Both
errors
andwarnings
point toEMPTY_ERRORS
, causingisEqual
to perform adeepEqual
comparison, determining thatwarnings
and theerrors
already existing inrefSet
have the same reference.errors
與warnings
皆指向EMPTY_ERRORS
,造成 isEqual 進行deepEqual
時,判斷warnings
與已存在於refSet
的errors
有相同的 reference(参考)。field-form/src/Field.tsx
Lines 148 to 149 in 294125e
field-form/src/Field.tsx
Lines 517 to 518 in 294125e
field-form/src/Field.tsx
Lines 240 to 242 in 294125e
Related Pull Request 相關的 PR
#604
The text was updated successfully, but these errors were encountered: