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

MonthPicker in range mode in controlled form endlessly useEffect calls #7336

Open
2 tasks done
openscript opened this issue Jan 7, 2025 · 1 comment
Open
2 tasks done

Comments

@openscript
Copy link

openscript commented Jan 7, 2025

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.15.3

What package has an issue?

@mantine/dates

What framework do you use?

Vite

In which browsers you can reproduce the issue?

All

Describe the bug

When using the <MonthPicker> in range mode within a controlled form use-date-state.ts endlessly calls useEffect at

if (_value[0] && !_value[1]) {
setPickedDate(_value[0]);
} else {
const isNeitherSelected = _value[0] == null && _value[1] == null;
const isBothSelected = _value[0] != null && _value[1] != null;
if (isNeitherSelected || isBothSelected) {
setPickedDate(null);
setHoveredDate(null);
}
}

The controlled form sets the value of the <MonthPicker> to [new Date(), null].

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-forked-qtxcvf

Possible fix

In Version 7.15.1 the issue was not present.

Self-service

  • I would be willing to implement a fix for this issue
@openscript openscript changed the title MonthPicker in range mode in controlled form endlessly useEffect calls regression MonthPicker in range mode in controlled form endlessly useEffect calls Jan 7, 2025
@openscript
Copy link
Author

Seems to be a regression from #7278

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

No branches or pull requests

1 participant