Skip to content

Compatibility issues with mobx-react #4

@Venryx

Description

@Venryx

This library appears to have conflicts with mobx-react.

Here is the thread where I discovered the issue, along with analysis of the cause: mobxjs/mobx-react#797

Summary: Because react-class-hooks replaces this.render after mobx-react has already created a reaction object (attached to the original render function), whenever MobX detects a change, it only calls the original render function -- not the wrapper that react-class-hooks added late (onto the instance).

What problems does it cause?

  1. It causes mobx-react to never clean up the reaction, causing a memory leak and potential drop in performance (from the reaction continuing to update, even past the component's unmounting).
  2. It likely causes react-class-hooks to not store/retrieve its data properly when re-renders are triggered by MobX. This is because the this.render override by react-class-hooks would not be called, meaning the stack counter would not be reset, leading to it just keeping on adding more cells instead of reading from existing ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions