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

ci: add Picker、CascaderPicker test #665

Merged
merged 1 commit into from
Mar 31, 2023
Merged

ci: add Picker、CascaderPicker test #665

merged 1 commit into from
Mar 31, 2023

Conversation

wyj580231
Copy link
Collaborator

  • Picker测试
  • CascaderPicker测试

@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2023

🎊 PR Preview a8c62dc has been successfully built and deployed to https://ant-design-ant-design-mini-preview-pr-665.surge.sh

🕐 Build time: 610.996s

🤖 By surge-preview

@@ -125,7 +125,7 @@ function createInstance(config: Instance, props: Record<string, any>) {
didUpdate.forEach(item => item.call(instance, prevProps, prevData));
},
callMethod(name: string, ...args: any) {
instance.methods[name].call(instance, ...args);
return instance.methods[name].call(instance, ...args);
},
unMount() {
didUnmount.forEach(item => item.call(instance));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个代码补丁包含两个函数,其中 createInstancecallMethod 有一个潜在的 bug。

createInstance 函数中,配置对象 config 包含一个名为 data 的字段。在修补程序的情况下,如果 data 是一个函数,则会调用它并将结果作为 data 的值。这是为了让每个实例都有自己的数据对象,而不是共享同一个数据对象。

但是,如果 config.data 是一个参数化函数,那么每次新的实例创建时,参数都没有更改,因此每次调用函数时获得的结果相同。这意味着不同的实例之间共享相同的数据对象,这不符合预期。应该确保每个实例都有不同的数据对象。

callMethod 函数中,函数返回值被丢失了。这可能会导致问题,因为调用方无法确定是否成功执行了方法。你可以尝试将函数返回 instance.methods[name].call(instance, ...args) 来解决该问题。

除此之外,代码没有明显的缺陷和有待改进的地方。

@jc9702507 jc9702507 merged commit bf5d1b1 into master Mar 31, 2023
@github-actions github-actions bot mentioned this pull request Apr 3, 2023
@DiamondYuan DiamondYuan deleted the test_0330 branch October 27, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants