react-component / react-component/picker
DatePicker 声明 disabledDate 在 year 视图下性能差
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 304
- Forks
- 345
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 7
Description
目前的 disabledDate 的设计是一个完全自由开放的设计,它可以是禁用连续的日期,可以是禁用独立的日期。
在渲染面板的时候,就会需要查找面板选项范围内是否存在可选的值,这样在极端情况下:即 year 面板,整年都不可选,则需要执行 365 次 disabledDate 才能推断出该年不可选。整个 year 面板最坏的情况是 3(列表) * 4 (行)* 365 次,相信没有人能接受这个性能吧😂。
所以我建议是不是在 year/month 视图不要应用 disabledDate,用户反正最终是要选到 date 上,能保证 date 的disabled 正常就可以了。或者是另外提供 disabledMonth、disabledYear 来解决性能问题
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 the DatePicker disabledDate handling for year and month views, then reproduce the reported repeated callback evaluation in the year panel. Confirm the desired behavior with maintainers, including whether to skip disabledDate or introduce disabledMonth and disabledYear; done requires an agreed API, preserved date-level disabling, and regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100