question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Naming Containers for Debugging Purposes

See original GitHub issue

I want to be able to distinguish different container context providers by name when using React DevTools.

Unnamed context providers: image

Even though I know I could just have a single container provider for my whole app (and therefore the naming would not be necessary as it would be clear what the provider is), I currently am migrating from raw-context usage and still have my contexts separated.

All of my contexts do this with the createContainer API:

const {Provider, useTrackedState} = createContainer(() => useState({...}));

// derive some custom hooks from useTrackedState...

export {Provider as SpecificSystemProvider};

And when I stitch together all of my providers, during runtime, I am unable to distinguish from the different providers I’ve created (regardless if they are globally scoped or locally scoped), as seen in the screenshot.

Provider.displayName = 'SpecificSystemProvider'; does not seem to work 😢

The React Context docs says you can name the underlying Context object with displayName, so could createContainer() have an optional containerName parameter that changes the internal context.displayName for debugging purposes?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dai-shicommented, Jan 12, 2022

https://www.npmjs.com/package/react-tracked/v/1.7.6 is published. thanks for your contribution. closing.

1reaction
seanbloniencommented, Jan 12, 2022

Yea looks good to me, tested these changes with my enterprise app and seems to work as simply as we’d expect it (not much to it really).

Yes, totally cool with contributing to OSS, I love what you do and the amazing packages you’ve given to the community ❤

Read more comments on GitHub >

github_iconTop Results From Across the Web

3 Tips for Naming Docker Containers - DigitalOcean
1 — Name the container when you run it​​ There are limitations, however. Since container names must be unique, you cannot use deliberate...
Read more >
Ten tips for debugging Docker containers | by Mark Betz
10 — Run one process in each container.​​ This last one is less of a debugging tip, and more of a best practice...
Read more >
Debug an app running in a Docker container
Debug an app running in a Docker container, using Visual Studio Code. ... containerName, Name of the container used for debugging.
Read more >
What is a Container? | Debugging in Containers - YouTube
To understand how to debug inside a container, we should understand what makes up a container. The main components of a container are:-...
Read more >
How to Fix and Debug Docker Containers Like a Superhero
Container errors are tricky to diagnose, but some investigative magic works wonders. Read along to learn how to debug Docker containers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found