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

[@mantine/core] Select: Fix search text not updating #4822

Merged
merged 1 commit into from Sep 21, 2023

Conversation

DoubleJ-G
Copy link
Contributor

The select input isn't watching the data prop change after a value is already set, this will cause the underlying input to remain unchanged/blank. A simple case could be seen with something like this:

  const value = "Foo";
  const [options, setOptions] = useState([]);

  useEffect(() => {
    const optionsSetter = setTimeout(() => {
      setOptions(["Foo", "Bar"]);
    }, 1500);
    return () => clearTimeout(optionsSetter);
  });

  return (
      <Select data={options} value={value} />
  );

By watching the optionsLockup in the useEffect dependencies it should catch updates to that data.

@rtivital rtivital merged commit 4a15a71 into mantinedev:master Sep 21, 2023
1 check passed
@rtivital
Copy link
Member

Thanks!

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.

None yet

2 participants