-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Button: Keep deprecated props in type definitions #59913
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,10 +65,9 @@ function useDeprecatedProps( { | |
} | ||
|
||
if ( isDefault ) { | ||
deprecated( 'Button isDefault prop', { | ||
deprecated( 'wp.components.Button `isDefault` prop', { | ||
since: '5.4', | ||
alternative: 'variant="secondary"', | ||
version: '6.2', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we at least bump this so we still remove it in some future WP version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the ambiguous back compat policy biting us again 😅 Up to this point the components package hasn't done many hard deprecations, mostly because a lot of these back compat layers are very low cost. Like virtually zero cost compared to the migration management cost we'd push to our third-party consumers who have to support multiple WP versions, and also the cost incurred on the end users who see incorrectly styled UI from all the consumers that never migrate. And in that vein, I'm not particularly enthusiastic about logging deprecation warnings on "simple translation" API changes like this that really add no value to anyone. If we're not planning to hard deprecate, then there's no reason for consumers to migrate to the new API unless they want to for ergonomics or code quality reasons. I've been hearing that even managing these deprecation warnings while supporting multiple WP versions is cumbersome, so I don't consider them "free" even though they're dev-env only. Happy to discuss and explicitly codify things a bit more, but I'm in no rush to hard deprecate things unless they have a tangible maintenance cost. |
||
} ); | ||
|
||
computedVariant ??= 'secondary'; | ||
|
@@ -87,7 +86,7 @@ function useDeprecatedProps( { | |
} | ||
|
||
export function UnforwardedButton( | ||
props: ButtonProps, | ||
props: ButtonProps & DeprecatedButtonProps, | ||
ref: ForwardedRef< any > | ||
) { | ||
const { | ||
|
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.
Any idea why we don't have
deprecated()
calls for the rest of the variant old props (likeisSmall
,isPrimary
, etc.)?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.
I can't find an explicit reason being given, but it does look intentional.
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.
Looks like we just wanted to soft-deprecate first, and to hard-deprecate later: #31713 (comment)
It's been almost 3 years, so maybe it's about time for hard deprecation.