-
Notifications
You must be signed in to change notification settings - Fork 698
fix: resolve React 19 compatibility by replacing defaultProps with attrs #1351
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2c85863 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@ryan-roemer any chance we can get this merged and a release pushed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Released in https://www.npmjs.com/package/spectacle/v/10.2.2 @LegNeato let us know how it goes if you get a chance to upgrade! |
Thank you! it seems to work. Some styling changed but I am not sure if that is on my end or yours. Thanks again! |
Description
This PR fixes React 19 compatibility issues in Spectacle by replacing all usage of the deprecated
defaultProps
pattern with styled-components'attrs
method.React 19 removed support for
defaultProps
on function components, which was breaking components throughout the Spectacle codebase. While the issue was initially reported for the FullScreen component, investigation revealed that many other components (typography, table, and layout primitives) were also affected.The solution follows the recommended approach from styled-components using the
attrs
method with function variant syntax, which allows props to override defaults while maintaining full backward compatibility.Key Changes:
defaultProps
withstyled.component.attrs((props) => ({ ...defaults, ...props }))
patternFixes #1350
Type of Change
How Has This Been Tested?
Comprehensive Testing Performed:
pnpm run check:ci
- all 26 scripts passpnpm run build
- successful compilationTest Configuration:
Checklist: (Feel free to delete this section upon completion)
pnpm run check:ci
and all checks pass