Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Hooks incompatible with legacy context #1304

@matt-tingen

Description

@matt-tingen

After updating from react 16.4.1 to 16.8.1, I'm seeing some odd behavior for existing components using legacy context. The observed behavior for functional components is as follows:

Hooks, no context

The devtools work as expected.

Context, no hooks

The devtools do not show the context section.

Context and Hooks

The devtools:

  • Do not show the context section
  • Show the hooks section with just "Loading..."
  • Errors trying to read from context:
Uncaught TypeError: Cannot read property 'counterLabel' of undefined
    at ContextAndHook (ContextAndHook.js:29)
    at backend.js:formatted:9096
    at S (backend.js:formatted:9103)
    at i (backend.js:formatted:9127)
    at e.<anonymous> (backend.js:formatted:9137)
    at e.r.emit (backend.js:formatted:4741)
    at backend.js:formatted:4364
    at backend.js:formatted:5581
    at Array.forEach (<anonymous>)
    at backend.js:formatted:5580
    at Array.forEach (<anonymous>)
    at t.value (backend.js:formatted:5577)
    at e (backend.js:formatted:4192)

Minimal Repro

Source
Preview

Inspect the three buttons in order in react devtools and observe the behavior described above.

Similar issues

This all seems similar to #1174, but I'm using v3.6.0 and that issue relates to the newer Context API.

Also, possibly related to #1295.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions