question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Warning] The initialValues only take effect when the form is initialized, if you need to load asynchronously recommended request, or the initialValues?<Form/>:null

See original GitHub issue

🐛 bug 描述

The initialValues only take effect when the form is initialized, if you need to load asynchronously recommended request, or the initialValues?<Form/>:null
at BaseForm
at RequestForm
at ProForm
at div
at div
at div
at Login
at LoadableComponent
at Route
at Switch
at Route
at Switch
...

🏞 期望结果

行为大概是预期表现?是否可以优化一下,主要是觉得影响开发体验。

💻 复现代码

npx create-umi myapp
# ❯ ant-design-pro
# ❯ V5

当开启热更新时

// config/config.ts
fastRefresh: {},

使用表单组件 initialValues

<ProForm
    initialValues={{
        autoLogin: true,
    }}
></ProForm>

控制台就报以上警告。

© 版本信息

  • Ant Design Pro 版本: [e.g. 5.0.0]
  • umi 版本 [3.4.0]
  • 浏览器环境 [Chrome]
  • 开发环境 [e.g. mac OS]
  • @ant-design/pro-form: 1.18.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chenshuai2144commented, Aug 6, 2021

fastRefresh 是通过不停更新 props 来实现的,可以忽略掉。

l这个只出现一次,但是可以大大的减少我们的答疑成本

0reactions
chao325commented, Aug 11, 2021

Thank

------------------ 原始邮件 ------------------ 发件人: “ant-design/ant-design-pro” @.>; 发送时间: 2021年8月11日(星期三) 下午2:29 @.>; @.@.>; 主题: Re: [ant-design/ant-design-pro] [Warning] The initialValues only take effect when the form is initialized, if you need to load asynchronously recommended request, or the initialValues?<Form/>:null (#8887)

恩,可以忽略的,我改了下判读

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't set form initialValues from state · Issue #22372 - GitHub
In v4, the bug has been fixed. initialValues only takes effect when initializing and resetting the form. 3
Read more >
Update initialValues in redux-form asyncronously without ...
The docs for ReduxForm say that initialValues can only be set once without manually doing an INITIALIZE, so I doubt that using a...
Read more >
Initializing From State - Redux Form
By default, you may only initialize a form component once via initialValues . There are two methods to reinitialize the form component with...
Read more >
Use AsyncPackage to load VSPackages in the background
If you have asynchronous initialization work to do, you should override InitializeAsync. Remove the Initialize() method provided by the VSIX ...
Read more >
Set form values in useEffect hook after async data load
A quick example of how to set field values in a React Hook Form after loading data asynchronously (e.g. from an API request)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found