Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangePicker组件在onCalendarChange方法中调用form.setFieldsValue会导致时间不可选择 #49470

Open
FlyAboveGrass opened this issue Jun 18, 2024 · 8 comments · May be fixed by react-component/field-form#718
Labels
🐛 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. Inactive

Comments

@FlyAboveGrass
Copy link

FlyAboveGrass commented Jun 18, 2024

Reproduction link

[Edit on StackBlitz

Steps to reproduce

  1. 正常选择开始结束时间,点确定
    2.重新打开时间选择,选择时间,发现不可以选择。选择什么时间都会跳回之前的选择时间

What is expected?

RangePicker 可以正常选择

What is actually happening?

RangePicker 不可以选择

Environment Info
antd 5.18.2
React 18
System macos
Browser Edge

在5.13.2及之前的版本可以正常使用。应该是5.14.0重构之后出现的问题。
form.setFieldValue 这个方法可以正常使用。

之前已经被标记为 bug,issue 被误删了,重新提一个。

Copy link

stackblitz bot commented Jun 18, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@MadCcc MadCcc added 🐛 Bug Ant Design Team had proved that this is a bug. and removed unconfirmed labels Jun 19, 2024
@heiyu4585 heiyu4585 self-assigned this Jun 20, 2024
@heiyu4585 heiyu4585 removed their assignment Jul 6, 2024
@FlyAboveGrass
Copy link
Author

@MadCcc 能重新分配一个人吗?😂

@clydee-geng
Copy link

clydee-geng commented Aug 14, 2024

@FlyAboveGrass 看了你那个例子,不明白为什么要用 name: '任意字符',,换成 RangePicker: dates, 是没问题的
const onCalendarChange = (dates, dateStrings, info) => {
form.setFieldsValue({
RangePicker: dates,
});
};

@FlyAboveGrass
Copy link
Author

@FlyAboveGrass 看了你那个例子,不明白为什么要用 name: '任意字符',,换成 RangePicker: dates, 是没问题的 const onCalendarChange = (dates, dateStrings, info) => { form.setFieldsValue({ RangePicker: dates, }); };

可能我的例子存在一些误解。我更新了例子的内容。
setFieldsValue 的时候是可以只对表单的某个字段(比如叫 A)进行赋值的,我在 RangePicker 变化的时候希望动态更改 A 的值,但是我并不需要主动对 RangePicker 的表单字段进行更改(因为它已经被 form 劫持,本就应该根据我的选择而变化)。

现在的问题是,我调用了 setFieldsValue 会影响到 RangePicker 的自动变化

@clydee-geng
Copy link

@FlyAboveGrass 看了你那个例子,不明白为什么要用 name: '任意字符',,换成 RangePicker: dates, 是没问题的 const onCalendarChange = (dates, dateStrings, info) => { form.setFieldsValue({ RangePicker: dates, }); };

可能我的例子存在一些误解。我更新了例子的内容。
setFieldsValue 的时候是可以只对表单的某个字段(比如叫 A)进行赋值的,我在 RangePicker 变化的时候希望动态更改 A 的值,但是我并不需要主动对 RangePicker 的表单字段进行更改(因为它已经被 form 劫持,本就应该根据我的选择而变化)。

现在的问题是,我调用了 setFieldsValue 会影响到 RangePicker 的自动变化
get

@afc163
Copy link
Member

afc163 commented Aug 15, 2024

确实有问题,可以来帮忙排查一下

@afc163 afc163 added the help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Aug 15, 2024
Copy link
Contributor

Hello @FlyAboveGrass. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to proper branch (feature branch for the new feature, master for bugfix and other changes), fill the Pull Request Template here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!

你好 @FlyAboveGrass,我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到正确的分支(新特性发到 feature 分支,其他发到 master 分支),务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献。

giphy

@nishino-tsukasa
Copy link

nishino-tsukasa commented Oct 23, 2024

请问这个问题的修复什么时候会发布呀 @afc163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. Inactive
Projects
None yet
6 participants