Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

onUpdate and onInitialized shouldn't pass a DOM element #49

Closed
@vdh

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /