Skip to content

Conversation

chris-schneider-zen
Copy link
Contributor

Description

As of React v19 defaultProps is fully deprecated. Currently in React v18 it does warn against this being removed, so we can easily migrate these within the codebase.

This PR does the work of eliminating and replace defaultProps with one of two patterns:
a. default parameter values (with destructuring)
b. nullish coalescing within styled::attrs() callbacks

Details

@@ -21,9 +21,9 @@ const AccordionComponent = forwardRef<HTMLDivElement, IAccordionProps>(
       children,
       isBare,
       isCompact,
-      isAnimated,
+      isAnimated = true,
       isExpandable,
-      isCollapsible,
+      isCollapsible = true,
       level,
       onChange,
       defaultExpandedSections,
@@ -103,11 +103,6 @@ const AccordionComponent = forwardRef<HTMLDivElement, IAccordionProps>(
 
 AccordionComponent.displayName = 'Accordion';
 
-AccordionComponent.defaultProps = {
-  isAnimated: true,
-  isCollapsible: true
-};
-

Checklist

  • 👌 design updates will be Garden Designer approved (add the designer as a reviewer)
  • 🌐 demo is up-to-date (npm start)
  • ⬅️ renders as expected with reversed (RTL) direction
  • ⚫ renders as expected in dark mode
  • 🤘 renders as expected with Bedrock CSS (?bedrock)
  • 💂‍♂️ includes new unit tests. Maintain existing coverage (always >= 96%)
  • ♿ tested for WCAG 2.1 AA accessibility compliance
  • 📝 tested in Chrome, Firefox, Safari, and Edge

Copy link
Member

@jzempel jzempel left a comment

Choose a reason for hiding this comment

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

@ chris-schneider-zen thanks so much for your patience on this. The update is looking great. I left a few comments. Along with addressing those, if you're able to make a couple of updates, I think we'll be able to get this through fairly quickly:

  • resolve conflicts with the current main branch
  • if possible, move this to a direct branch rather than a fork (I sent you an org invite). That will make sure the full CI runs, including deployment. And that will make my turnaround review much easier.

🙇

<StyledParagraph ref={ref} {...props} />
));
export const Paragraph = forwardRef<HTMLParagraphElement, IParagraphProps>(
({ size = 'medium', ...props }, ref) => <StyledParagraph ref={ref} size={size} {...props} />
Copy link
Member

Choose a reason for hiding this comment

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

Not imperative for this PR, but it would be good to fix the $size transient prop naming for the underlying StyledParagraph component

@chris-schneider-zen
Copy link
Contributor Author

👋🏼 Hello, just getting back to this. I'm going to get this migrated over to the official repo and get a new PR going with the changes requested.

@jzempel
Copy link
Member

jzempel commented Aug 27, 2025

Brilliant, thanks @chris-schneider-zen – users will be happy to see those console errors go away.

@chris-schneider-zen
Copy link
Contributor Author

Closing this PR in favor of #2045

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

Successfully merging this pull request may close these issues.

2 participants