Skip to content

Descriptive error message when Theme context is not found #597

Answered by SiTaggart
alecnicolas asked this question in General
Discussion options

You must be logged in to vote

Hi @alecnicolas, it's certainly not ideal and it trips folks up alot of the time. We've called it out in the getting started docs https://paste.twilio.design/getting-started/engineering#jest-testing but adding some kind of check might be beneficial in the long run.

It's a little bit tricky to do right now as there are a few places we'd need to check based on certain component implementations. There isn't currently a central place where we could check, for any given component, are you in a theme provider. In the near future once all our components are just using Box under the hood, we could just do a single check inside of Box. Check if there is a theme, if not, console.error or something.

I…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by alecnicolas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants