Skip to content

[DevTools Bug]: React 17 error while trying to inspect hooks "Context reads do not line up with context dependencies." #28960

Closed
@gdeedlerthryv

Description

@gdeedlerthryv

Website or app

https://github.com/gdeedlerthryv/react-dev-tools-test/

Repro steps

  1. Inspect TestApp component
  2. Get error
backendManager.js:117 React DevTools encountered an error while trying to inspect hooks. This is most likely caused by an error in current inspected component: "TestApp".
The error thrown in the component is: 

 Error: Context reads do not line up with context dependencies. This is a bug in React Debug Tools.
    at H (react-debug-tools.production.min.js:14:310)
    at Proxy.useContext (react-debug-tools.production.min.js:18:40)
    at Object.useContext (chunk-GGTEBMAR.js?v=b51a6ac3:1125:29)
    at useLocation (chunk-PFB6EJD6.js?v=b51a6ac3:3382:16)
    at TestApp (main.jsx:13:20)
    at R (react-debug-tools.production.min.js:32:287)
    at exports.inspectHooksOfFiber (react-debug-tools.production.min.js:35:150)
    at inspectElementRaw (renderer.js:3379:36)
    at Object.inspectElement (renderer.js:3716:38)
    at agent.js:420:18

Screenshot 2024-04-30 at 3 58 07 PM

Issue was introduced by DevTools 5.1.0 release, I think this PR is the culprit. I built the 5.0.2 extension and the error did not occur:
Screenshot 2024-04-30 at 3 57 37 PM

I wasn't able to repro the issue without external libraries, but someone who knows better probably could.

How often does this bug happen?

Every time

DevTools package (automated)

No response

DevTools version (automated)

No response

Error message (automated)

No response

Error call stack (automated)

No response

Error component stack (automated)

No response

GitHub query string (automated)

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions