Data and layout changes are lost while the plot is initializing
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- angular, typescript
- 领域
- frontend
调研方向
从 PlotlyComponent.ngDoCheck 和调用 Plotly.newPlot 的初始化路径开始;issue 指出,当 plotlyInstance 为 undefined 时,diff 已被消耗,而更新却没有应用。追踪初始化如何完成以及更新如何应用,然后补充测试,覆盖 newPlot 完成前数据或布局发生变化的情况。完成标准是:初始化后,图表无需再有其他变化即可显示最新输入。
由索引模型根据 Issue 内容生成。
描述
Description
PlotlyComponent drops [data] and [layout] changes that arrive before Plotly.newPlot resolves. The chart keeps showing the initial input until another change happens later.
The window is easy to hit with PlotlyViaCDNModule or PlotlyViaWindowModule, where newPlot waits for plotly.js to load, and with traces whose newPlot is asynchronous. A typical case is a chart that starts with [data]="[]" and receives data from an HTTP request that completes before plotly.js finishes loading.
Cause
ngDoCheck detects the change, which consumes the differ's diff, but only calls updatePlot() when plotlyInstance is set. During initialization plotlyInstance is still undefined, so the update is skipped. newPlot was already called with the old input, so the newer input is never drawn.
Steps to reproduce
- Load plotly.js through
PlotlyViaCDNModule. - Render
<plotly-plot [data]="data"></plotly-plot>withdata = []. - Set
datato a new array before the CDN script finishes loading (for example, from a fast HTTP response or asetTimeout(..., 0)).
Expected: the chart shows the new data.
Actual: the chart stays empty until data or layout changes again.
Affected versions
v20, v21, and master (same code in ngDoCheck).
- 主要语言
- TypeScript
- 星标
- 242
- 派生
- 81
- 平均合并
- 23 小时 52 分钟
- 30 天内合并 PR
- 5
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/angular-plotly.js 的其他 Issue
-
Feature request: please add migration guide可能已有人在做 @andrefarzat 于 21 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 45/100
plotly/angular-plotly.js#285 · 3 条评论 ·
维护者通常 1 天内回复
-
event handlers are not typed可能已有人在做 @andrefarzat 于 21 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 38/100
plotly/angular-plotly.js#283 ·
维护者通常 1 天内回复
-
Angular 20 standalone application可能已有人在做 @andrefarzat 于 21 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
plotly/angular-plotly.js#281 · 8 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 25/100
plotly/angular-plotly.js#278 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 38/100
plotly/angular-plotly.js#276 · 2 条评论 ·
维护者通常 1 天内回复
查看 plotly/angular-plotly.js 的全部 Issue
相似的 Issue
-
needs investigation
难度 2/5 1-3 小时 新手友好度 60/100
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area:visualizer tech-debt
难度 2/5 1 小时以内 新手友好度 66/100
jmbarzee/temporal-architect#292 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
riverqueue/river#1576 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
colbymchenry/codegraph#3228 ·
维护者通常 1 天内回复