react-component / react-component/picker

onCalendarChange is called with wrong value if only one value set in RangePicker

Open
#783 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
304
Forks
345
Avg merge
2d 7h
Merged PRs (30d)
7

Description

In RangePicker when both start and end values are selected, if the user changes only the end value and clicks outside, the value is correctly set to [oldStartValue, newEndValue] but onCalendarChange is called after onChange with the wrong values [oldStartValue, oldEndValue]

Here is the reproduction:
https://codesandbox.io/p/sandbox/cocky-tamas-fflnh2

Here is a screenshot:
Screenshot 2024-04-02 at 11 36 33 AM

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RangePicker behavior described in the linked CodeSandbox reproduction and trace the callback sequence when both values exist but only the end value changes. Reproduce the case, then verify that onCalendarChange receives the updated range rather than the old values after onChange.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.