dash-renderer: determineChangedProps scans every layoutHashes entry for each dashChildrenUpdate component on every store update
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, react
- 领域
- frontend, performance
调研方向
Start in the dash-renderer implementation of selectDashProps, determineChangedProps, isFirstLevelPropsChild, and the layoutHashes state path. Reproduce the repeated scans with flagged dashChildrenUpdate components, then evaluate an indexing or per-update approach while confirming that children still update correctly and the measured rendering cost improves.
由索引模型根据 Issue 内容生成。
描述
Versions: dash 3.4.0 (the same code is in 4.4.1), dash-mantine-components 2.5.1, Chromium.
What happens. In selectDashProps, a component whose type sets dashChildrenUpdate calls determineChangedProps(state, strPath). That function iterates Object.entries(state.layoutHashes) and calls isFirstLevelPropsChild, which does two split(',') calls per entry. It does this for every flagged component, on every Redux store update (callback responses, loading-state and request bookkeeping included). layoutHashes gains one entry per path whose props ever changed and never shrinks. So the cost is roughly O(flagged components × changed paths × store updates), and it grows the longer a tab stays open.
Why it bites. DMC sets the flag on MenuItem, MenuDropdown, MenuLabel, SubMenu*, Tooltip, FloatingTooltip, PopoverDropdown, HoverCardDropdown, Stepper and Timeline; dcc sets it on Tabs. An app with a keepMounted header menu (which callbacks inside a closed menu require) and tooltips on navbar links has dozens of flagged components mounted on every page.
Measured (production app; CPU profile via the Chrome DevTools Protocol; headless Chromium; 5 full loads per page):
- The anonymous
isFirstLevelPropsChildcomparison was the single hottest function. It took 0.84–2.07 s of main-thread time between a page's layout arriving and its content rendering. - Deleting
dashChildrenUpdatefrom the DMC menu and tooltip types before the renderer reads them made page content appear 1.5–2.2× sooner, e.g. 2.83 s → 1.54 s and 5.36 s → 2.56 s. Main-thread busy time fell 3–4×. - Children inside those components still updated correctly.
Possible fixes:
- Index
layoutHashesby parent path, so a component only looks at its own direct children. - Or compute the descendant hash once per store update rather than once per flagged component.
- Or let component libraries opt out per type when nothing in the type reads its children's props.
Workaround we use: an inline <head> script, defined before the component bundles load, that traps window.dash_mantine_components and deletes the flag from the menu and tooltip types.
- 主要语言
- Python
- 星标
- 24.4k
- 派生
- 2.3k
- 平均合并
- 2 天 5 小时
- 30 天内合并 PR
- 22
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/dash 的其他 Issue
-
P2 plotly-internal size: 1 task
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
Extract graph schema validation into properly named test可能已有人在做 @Nice6042 于 56 天前认领。 未关闭good first issue P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapper可能已有人在做 @KoolADE85 于 4 天前认领。 未关闭bug P2 size: 1
难度 4/5 3-5 天 新手友好度 56/100
plotly/dash#4042 · 3 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
P3 plotly-internal size: 10+ task
难度 5/5 一周以上 新手友好度 30/100
维护者通常 2 天内回复
-
P2 plotly-internal size: 5 task
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
UKGovernmentBEIS/inspect_ai#5802 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
no-human-ai/no_human#660 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
documentation need help question
难度 1/5 1-3 小时 新手友好度 66/100
phonology024/babelscribe#26 ·
-
bug
难度 2/5 1-3 小时 新手友好度 62/100