Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Conversation

@ckolderup
Copy link
Contributor

@ckolderup ckolderup commented Apr 22, 2022

Since the recent upgrade to a newer version of styled-components we've been seeing the error (labeled a warning, but counted as an error in the developer tools) below on all page loads, due to the tooltip component's fallback prop.

Warning: Received `false` for a non-boolean attribute `fallback`.
Warning: Received `false` for a non-boolean attribute \`fallback\`.

If you want to write it to the DOM, pass a string instead: fallback="false" or fallback={value.toString()}.

If you used to conditionally omit it with fallback={condition && value}, pass fallback={condition ? value : undefined} instead.

The problem is that when we pass the fallback attribute to the styled.div, it's giving that attribute to the div itself, which isn't a valid attribute. I'm not entirely sure why the warning claims that it's not a bool, because the fallback prop in the outer component is a boolean, but regardless, using a "transient prop" for the styled div fixes the problem when I use this canary build in the community repo.

📦 Published PR as canary version: 0.22.4--canary.142.351ff43.0

✨ Test out this PR locally via:

npm install @glitchdotcom/shared-components@0.22.4--canary.142.351ff43.0
# or 
yarn add @glitchdotcom/shared-components@0.22.4--canary.142.351ff43.0

@ckolderup ckolderup requested a review from keithk April 22, 2022 19:23
Copy link
Contributor

@keithk keithk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANK YOU I COULD NOT GET RID OF THIS WARNING

@ckolderup ckolderup merged commit 55abe6d into master May 3, 2022
@ckolderup ckolderup deleted the casey/use-transient-prop-for-tooltip branch May 3, 2022 17:38
@keithk
Copy link
Contributor

keithk commented May 3, 2022

🚀 PR was released in v0.22.4 🚀

@keithk keithk added the released label May 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants