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

[Bug] State Update Without Re-render When Using Custom Timepicker with Range Picker #299

Open
vc-vishal opened this issue Jun 26, 2024 · 0 comments

Comments

@vc-vishal
Copy link

vc-vishal commented Jun 26, 2024

Environment
React: 16.14.0
react-multi-date-picker: ^4.5.2
Browser: Chrome (latest)
Operating System: Windows 10

Issue Description:

When integrating the react-multi-date-picker package in my application with custom Timepicker and footer buttons (Apply and Cancel), I noticed that the package is updating state directly without causing a re-render. This leads to inconsistent state management and unexpected behavior.

I knew this package works without state, but I didn't imagine how problematic this feature would be for my requirement.

1st I have implemented custom Timepicker which have double Time select.

2nd I have implemented Cancel and Apply buttons in footer plugin. I have managed Apply and Cancel button using multiple states.

Additionally, I implemented a custom timepicker plugin that does not use the state and handler provided by this package. Despite this, the package is updating my state without following React's conventions, causing state updates without re-renders.

Watch console.log("selectedRange OutSide", selectedRange?.toString()); when updating time from timepicker.

codesandbox:

As this is React package, I recommend that this package should provide a way to work fully controlled with React states.

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