Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Class components should not subscribe to state changes in the constructor. #103

Open

Description

@quisido

If a component has be instantiated (constructor has executed) but not yet mounted, this.updater will be undefined. If the global state is accessed in the constructor, it will subscribe. If it changes before mount, it will attempt to update, throwing an error that this.updater does not exist.

Either check that this.updater exists or prevent subscribing in the constructor (if possible to differentiate).

Activity

  1. added
    bugSomething isn't working as expected.
    on Jul 1, 2019
  2. added this to the 2.1.5 milestone on Jul 1, 2019
  3. self-assigned this
    on Jul 1, 2019
  4. modified the milestones: 2.1.5, 2.1.6 on Jul 21, 2019
  5. modified the milestones: 2.1.6, 2.1.8 on Aug 8, 2019
  6. removed their assignment
    on Sep 5, 2019
  7. added
    help wantedThe owner cannot resolve this on their own.
    and removed
    bugSomething isn't working as expected.
    on Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedThe owner cannot resolve this on their own.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions