-
-
Notifications
You must be signed in to change notification settings - Fork 139
Description
Currently, the way the onUpdate
and onInitialized
callbacks are sending updates back up is by passing this.el
, a.k.a. the graphDiv
/ gd
.
This has created some awkward breakages of the React lifecycle because now instead of passing plain prop objects back up, there's a whole DOM element with hidden extra data smuggled aboard (_fullData
, _fullLayout
, the element ref itself, possibly more undocumented deps...?) being passed around instead.
The updated data
and layout
objects should be sent separately, either as individual callback params, or within a plain object wrapper. If the additional values (graphDiv
, _fullData
, _fullLayout
, etc...) are still important dependencies that needs to be passed back up by the callback, then they should be broken out into their own unique params / wrapper keys. Then at least these advanced dependencies can be properly documented.
For example, react-plotly.js-editor
has difficult state management because it's been coded to rely on the graphDiv
exposed by the callbacks, instead of individual dependencies (data
, layout
, _fullData
, _fullLayout
, _context
).