mobxjs / mobxjs/mobx-react-devtools

Incompatibility with React.StrictMode

Open
#116 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.2k
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Hello and thanks for mobx and the devtools! :)

I'm trying to use the devtools in an app while using React's (relatively) new StrictMode. But I'm getting this error:

Warning: findDOMNode is deprecated in StrictMode.
findDOMNode was passed an instance of _class which is inside StrictMode.
Instead, add a ref directly to the element you want to reference.

The interesting thing is that it happens even when the devtools aren't mounted to a StrictMode tree:

<>
  <React.StrictMode>
    <TodoList todoStore={store} />
  </React.StrictMode>
  <MobxDevTools />
</>

I'm also able to reproduce the same issue in my real app.
Can anything be done about it? If not, we should at least have a note in the README.

Here's a codesandbox where you can see the issue: https://codesandbox.io/s/1jjgxvjzo?autoresize=1&expanddevtools=1&fontsize=14

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox and reproduce the findDOMNode warning under React.StrictMode, including when MobxDevTools is outside the StrictMode tree. Inspect the devtools integration responsible for the warning. Done means removing the warning where possible, or documenting the limitation in the README.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
devtools, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.