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

FormControl onChange 存在闭包 #2192

Open
MarvelSQ opened this issue Dec 9, 2021 · 2 comments · May be fixed by #2197
Open

FormControl onChange 存在闭包 #2192

MarvelSQ opened this issue Dec 9, 2021 · 2 comments · May be fixed by #2197
Labels

Comments

@MarvelSQ
Copy link
Member

MarvelSQ commented Dec 9, 2021

What version of rsuite are you using?

5.2.1

What version of React are you using?

17.0.2

What version of TypeScript are you using (if any)?

4.4.4

What browser are you using?

Chrome

Describe the Bug

当accepter 内部 change 方法未依赖 onChange时,局部刷新会影响其他form表单的其他数据

function AgeInput({ value, onChange }) {
  const handleChange = useCallback((age) => {
    onChange(age);
  }, []);

  return (
    <Input
      value={value}
      onChange={handleChange}
    />
  );
}

Expected Behavior

不依赖onChange的情况下,外部的表单可以正常更新

To Reproduce

https://codesandbox.io/s/smoosh-cache-mbg4l?file=/src/index.js

@MarvelSQ
Copy link
Member Author

MarvelSQ commented Dec 9, 2021

https://codesandbox.io/s/prod-tree-veylv?file=/src/index.js
v4版本中是可以正常工作的

@MarvelSQ MarvelSQ linked a pull request Dec 10, 2021 that will close this issue
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant