react-component / react-component/picker
Trigger onOpenChange shouldn't sync with onChange take effect.
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 304
- Forks
- 345
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 7
Description
demo:
const handleOpenChange =(visible: boolean) => {
if (visible) {
return
}
// get an old value
console.log('handleOpenChange', visible, dateRange)
//...
}
const handlePickerChange = ({ start, end }: { start: number, end: number}) => {
// setState
setDateRange({ startAt: dayjs(start).unix(), endAt: dayjs(end).unix() })
}
const pickerValue = isValidDateRange
? { start: dateRange.startAt! * 1000, end: dateRange.endAt! * 1000 }
: { start: null, end: null }
return (
<RcRangePick ... />
)
according to the source code above, I think the trigger onOpenChange shouldn't sync with onChange take effect. otherwise, a
lways get an old value in onOpenChange.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/RangePicker.tsx lines 775-778 and reproduce the supplied controlled-range example. Trace the ordering of onOpenChange and onChange, then verify that onOpenChange no longer observes the previous range value when the picker changes; the payload does not name a test file.
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
- 35/100