plotly / plotly/react-plotly.js
Event Handlers Don't Update
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 138
- 平均合併
- 3 天 2 小時
- 30 天內合併 PR
- 4
描述
I'm using 2.3.0 and noticed that the code doesn't account for an event handler prop changing. So, for instance, if I have a component with:
const MyComponent = ({ someCallback }) => (
<Plot
data={data}
onRelayout={someCallback}
/>
);
The someCallback that is called is the first one. Here's a Codepen reproducing:
https://codepen.io/gonzofish/pen/OevOjx
To see it in action, just click autoscale on the chart and you'll see the message change to "Callback 1 Reporting In". If you change the callback by clicking "Change to 2" and then clicking autoscale again, the message doesn't change, despite the callback being changed.
I believe the issues stems from syncEventHandlers only account for two modes: (1) the handler isn't already set but has been provided as a prop and (2) the handler was set but the prop is not longer there. That starts at:
https://github.com/plotly/react-plotly.js/blob/master/src/factory.js#L212
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 src/factory.js 第 212 行附近開始,查看 syncEventHandlers 處理 plot 事件 props 的位置,並使用連結的 CodePen 重現來觀察 callback 的變化。完成標準是:變更 onRelayout prop 後,下一個 autoscale 事件呼叫新的 callback,而不是原本的 callback。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, react
- 領域
- data-visualization, frontend
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 50/100