react-component / react-component/select

Performance regression when rendering the first time caused by call to setDropdownWidth

Open
#378 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

This commit has caused very slow performance when the component mounts since we are now calculating the dropdown width even if the dropdown menu is not visible.

See the screenshot below. setDropdownWidth is called for each dropdown menu when it mounts. Imagine this code running for every single input that is rendered on a page. It becomes very costly and results in large FPS drop.

image

Can we think of another solution that will fix this issue: https://github.com/ant-design/ant-design/issues/7943 and not cause a performance regression? I will investigate from my end as well, but I wanted to bring this to people's attention since others may have the same issue.

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 by reviewing commit 01bf6d1deb327a587be7b40d208684b1f1769f3d and tracing where setDropdownWidth runs during component mounting. Compare the behavior with the dropdown visibility state and verify that the fix for ant-design/ant-design#7943 remains intact without calculating widths for hidden menus; confirm the result with a performance comparison.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.