Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

onChange called on init when view == null #611

@fedotxxl

Description

@fedotxxl
  1. Create h1 opened, save
  2. Open, collapse h1, don't save
  3. Refresh

In this case, h1 state will be read from localStorage, differ from JSON persisted state and onChange callback triggered. The problem is that view is not ready and getting value will result to Cannot read properties of undefined (reading 'state')

Solution add this.view check?

  handleChange = () => {
    if (!this.props.onChange || !this.view) return;

    this.props.onChange(() => {
      return this.value();
    });
  };

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions