Event Handlers Don't Update

オープン
#150 コメント 0 件 リアクション 6 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
50/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
javascript, react

調査の方向性

src/factory.js の 212 行目付近から始め、syncEventHandlers が plot イベントの props を処理している箇所を確認し、リンクされた CodePen の再現例を使って callback の変更を観察してください。onRelayout prop を変更すると、次の autoscale イベントで元の callback ではなく新しい callback が呼び出されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
JavaScript
スター
1.1k
フォーク
138
平均マージ
3日 2時間
マージ済み PR(30日)
4

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

plotly/react-plotly.js のほかの issue

plotly/react-plotly.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。