Skip to content

Investigate whether plot.deoverlay() is necessary #5

@mrecachinas

Description

@mrecachinas

In src/hreflayer.js and src/websocketlayer.js,

  componentDidMount() {
    const { href, onload, options } = this.props;
    this.plot.deoverlay(); // <----------------
    this.layer = this.plot.overlay_href(href, onload, options);
  }

  componentWillReceiveProps(nextProps) {
    const {
      href: oldHref,
      options: oldOptions,
    } = this.props;

    const {
      href: newHref,
      onload: newOnload,
      options: newOptions,
    } = nextProps;

    // we only care if `href` or `options` changes
    if (newHref !== oldHref) {
      this.plot.deoverlay(); // <----------------
      this.plot.overlay_href(newHref, newOnload, newOptions);
    } else if (newOptions !== oldOptions) {
      this.plot.change_settings(newOptions);
    } else {
      return;
    }
  }

src/websocketlayer.js looks roughly the same.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions