Skip to content

[DevTools Bug]: Context display does not support HOC name taggingΒ #33210

Open
@mio-moto

Description

@mio-moto

Repro steps

We're using HOCs as a way to tag components with certain concerns, this gives us the ability to trim the React Devtools tree to trim down on components that are irrelevant or out of scope (or even specifically in scope).

Image

This works well, except that the name parsing does not apply for named contexts:

const MyOverlayContext = createContext<ContextData | undefined>(undefined);
MyOverlayContext.displayName = 'overlay(MyOverlayContext)'
// shows up as overlay(MyOverlayContext).Provider, instead of MyOverlayContext.Provider [overlay]
() => <MyOverlayContext.Provider />

Image

(We're aware that this isn't how ExoticNamedComponent or HOCs are meant to be used, but they give us the ability to quickly search the tree for certain tags, quickly filter out many browser- or display-like nodes, like <Button />, ` and so on. If you're taking PRs, I would have a look at that, too.)

How often does this bug happen?

Every time

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions