[DevTools Bug]: Context display does not support HOC name tagging
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 251k
- Forks
- 51.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 53
Description
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).
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 />
(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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the named-context example and trace the DevTools context display name parsing; the report does not identify a file or test. Done means a context with displayName 'overlay(MyOverlayContext)' is shown as MyOverlayContext.Provider [overlay], with coverage for the reported case.
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
- 35/100