Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid TypeError in getCSSVar when theme is an empty object #6274

Conversation

Philzen
Copy link
Contributor

@Philzen Philzen commented Jul 4, 2022

Closes #6270

📝 Description

This amends getCSSVars to include __cssMap in the optional operator chaining.

It fixes the root cause for #6270.

⛳️ Current behavior (updates)

Tooltip component throws:

Error name:    "TypeError"
Error message: "Cannot read properties of undefined (reading 'colors.red.600')"

at Object.getCSSVar (node_modules/@chakra-ui/utils/dist/chakra-ui-utils.cjs.dev.js:367:69)
          at node_modules/@chakra-ui/tooltip/dist/chakra-ui-tooltip.cjs.dev.js:306:57

when it is called in a test environment.

🚀 New behavior

It does not throw anymore when theme is an empty object 🥳

💣 Is this a breaking change (Yes/No):

No

@changeset-bot
Copy link

changeset-bot bot commented Jul 4, 2022

⚠️ No Changeset found

Latest commit: c4fdd98

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Jul 4, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
chakra-ui-storybook ✅ Ready (Inspect) Visit Preview Jul 4, 2022 at 8:53PM (UTC)

@Philzen Philzen changed the base branch from main to v1 July 4, 2022 20:48
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 4, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c4fdd98:

Sandbox Source
create-react-app-ts Configuration

@Philzen
Copy link
Contributor Author

Philzen commented Jul 4, 2022

@segunadebayo kindly advise if you agree with this change and if hopefully so, what changeset content is required for this and #6275.

Cheers.

@segunadebayo
Copy link
Member

Closing this as I merged the other duplicate PR.

@Philzen
Copy link
Contributor Author

Philzen commented Jul 5, 2022

Closing this as I merged the other duplicate PR.

This was intentionally a PR for the v1 branch – or are fixes cherry-picked over from main in a separate process?

Important sidenote: Many people still rely on v1 (myself included), because it is currently not possible to use v2 in a RedwoodJS project as it is still locked on React 17. That's why i'm hoping for a v1.8.9 patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants