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.

Devtools crashes when rendering Context.Provider #1174

@benwiley4000

Description

@benwiley4000

Thanks so much for adding support for Context with a displayName! Unfortunately devtools seems to be breaking now whenever a Context.Provider is rendered.

Repro:

const MyContext = React.createContext();
ReactDOM.render(
  <MyContext.Provider />,
  document.getElementById('container')
);

Version: 3.4.0 (september 20)
Google Chrome: 67.0.3396.62 (Official Build) (64-bit)
OS: Linux (elementary 4.13.0-43-generic)

Here's the line where we hit a snag:

name = `${fiber.type._context.displayName || 'Context'}.Provider`;

Stack trace:

backend.js:9969 Uncaught TypeError: Cannot read property 'displayName' of undefined
    at getDataFiber (backend.js:9969)
    at enqueueMount (backend.js:10137)
    at mountFiber (backend.js:10225)
    at backend.js:10285
    at Set.forEach (<anonymous>)
    at Object.walkTree (backend.js:10283)
    at backend.js:8534
    at <anonymous>:52:32
    at Array.map (<anonymous>)
    at Object.emit (<anonymous>:51:66)
getDataFiber @ backend.js:9969
enqueueMount @ backend.js:10137
mountFiber @ backend.js:10225
(anonymous) @ backend.js:10285
walkTree @ backend.js:10283
(anonymous) @ backend.js:8534
(anonymous) @ VM79:52
emit @ VM79:51
setupBackend @ backend.js:8621
module.exports @ backend.js:8567
(anonymous) @ backend.js:116
g @ backend.js:981
EventEmitter.emit @ backend.js:894
(anonymous) @ backend.js:302
(anonymous) @ backend.js:7619
(anonymous) @ backend.js:7618
_handleMessage @ backend.js:7611
listener @ backend.js:92
postMessage (async)
handleMessageFromDevtools @ contentScript.js:18
EventImpl.dispatchToListener @ VM68 extensions::event_bindings:403
publicClassPrototype.(anonymous function) @ VM74 extensions::utils:138
EventImpl.dispatch_ @ VM68 extensions::event_bindings:387
EventImpl.dispatch @ VM68 extensions::event_bindings:409
publicClassPrototype.(anonymous function) @ VM74 extensions::utils:138
dispatchOnMessage @ VM75 extensions::messaging:392

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