豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Optimize SMI-Table Rendering Performance #7613

@Manishnemade12

Description

@Manishnemade12

Description

In src/components/SMI-Table/index.js, the isCollapsed state is managed as a monolithic array residing at the parent Table component level. When a user clicks a table row, the row mutates an indexed element in this array triggering setCollapse([...e]). Because all rows are rendered via an inline mapping function within the parent component, every single click forces React to fully re-render the entire table body. For large tables with numerous complex elements (like Tooltips and Context Providers), this leads to noticeable UI lag.

Expected Behavior

The table's row-rendering logic should be refactored into a separate, lightweight TableRow component wrapped in React.memo(). The isCollapsed state should be pushed down into the individual SmiTableRow components as a simple boolean value (const [isCollapsed, setIsCollapsed] = useState(false)). This will substantially improve Time to Interactive (TTI) and Interaction to Next Paint (INP) for the SMI Table page.

Screenshots

Environment:

  • Host OS:
  • Browser:

Contributor Resources and Handbook

The layer5.io website uses Gatsby, React, and GitHub Pages. Site content is found under the master branch.

Join the Layer5 Community by submitting your community member form.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions