-
Notifications
You must be signed in to change notification settings - Fork 308
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(react): Conditionally render deprecation warning #3269
Conversation
🦋 Changeset detectedLatest commit: 942252d 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 |
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.
One non-blocking comment, LGTM!
message: | ||
"The Link component's to prop will soon be deprecated. " + | ||
'Please see the Amplify UI documentation for using the Link component with routing libraries: ' + | ||
'https://ui.docs.amplify.aws/react/components/link#routing-libraries', | ||
}); | ||
return ( | ||
<View | ||
as={as} | ||
as={as ?? 'a'} |
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.
Should we use a ternary here to be more explicit?
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.
+1
it('should not call console.warn if "to" prop is used with "as" prop', async () => { | ||
const spyWarn = jest.spyOn(console, 'warn'); | ||
render(<SampleRoutingApp />); | ||
expect(spyWarn).not.toHaveBeenCalled(); |
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.
Nice!
…ify/amplify-ui into conditional-deprecation-warning
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.
LGTM!
Description of changes
Only show the
Link
component'sto
prop deprecation warning if the customer does NOT provide anas
prop.Fixes: #2889
Issue #, if available
#2889
Description of how you validated changes
Tested locally with a few examples on the docs site.
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.