-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat: use React.forwardRef in all components #4233
Conversation
size-limit report
|
Codecov ReportBase: 99.75% // Head: 99.51% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #4233 +/- ##
==========================================
- Coverage 99.75% 99.51% -0.24%
==========================================
Files 180 186 +6
Lines 3248 3511 +263
==========================================
+ Hits 3240 3494 +254
- Misses 8 17 +9
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
* chore(Ref): remove component * fix tests
* chore(Search): use React.forwardRef() * add test for ref forwarding * fix tests, add comments
* chore: refactor tests for shorthands to use mount() * add comment * fix tests with unmount
* Convert form to function component * Add ref forwarding to Form component * Update test/specs/collections/Form/Form-test.js Co-authored-by: Oleksandr Fediashov <[email protected]> Co-authored-by: Oleksandr Fediashov <[email protected]>
* Add ref to FormButton * Add ref to FormCheckbox * Add forwardRef to FormGroup * Remove accidental `only` calls
* Add ref to form field component * Move ref to controlProps * Add more forwardsRef tests * Remove unnecessary describe wrapper * update tests Co-authored-by: Oleksandr Fediashov <[email protected]>
* chore(Select): use React.forwardRef() * chore(FormSelect): use React.forwardRef() * chore(FormDropdown): use React.forwardRef() * fix tests, fix Dropdown component Co-authored-by: Oleksandr Fediashov <[email protected]>
88974b5
to
6c03c11
Compare
Awesome guys, really nice work with the progress these last couple of days! 👏👏 |
What should be merged? :] |
Thank you folks, been waiting a while for this |
Oops, missed a word. |
Giving this a test and look over 👀 Fantastic effort everybody, thank you 😍 |
I have been testing components and looking over changes this morning. Looks good! I will release the beta now and we can follow up on any clean up items. Superb job as usual @layershifter, much appreciated. |
Thanks everyone 👍
|
except React.ref, what are the changed? |
@felixmosh I will publish migration notes and guidance in upcoming days, shortly:
|
Been running 3.0.0-beta.0 for in my dev environment for some days now. Tested a lot of the pages and functionality with it. No issues so far, apart from the expected refs that needed to be changed for form elements. Great work! |
FYI Migration guide is available (https://react.semantic-ui.com/migration-guide/), changelog was also updated. |
@@ -195,7 +251,7 @@ export default class Popup extends Component { | |||
) : ( | |||
children | |||
)} | |||
{hideOnScroll && <EventStack on={this.hideOnScroll} name='scroll' target='window' />} | |||
{hideOnScroll && <EventStack on={hideOnScroll} name='scroll' target='window' />} |
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.
@layershifter after refactoring the Popup to FC, there is a hideOnScroll
callback and prop name clash. It causes the guard be always truthy and thus the prop does not work. The callback should be renamed.
I think that this PR should be reviewed again because there might be more occurrences of this same issue. What do you think?
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.
@dominikdosoudil good catch, please trigger an issue and feel free to submit a 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.
Apparently there exists both issue and PR #4490 (at least for the popup)
This PR is a part of work for Semantic UI React v3 🎉
All components in this PR have been converted to be functional components (
Dropdown
is an exception, it uses a wrapper) and useReact.forwardRef()
to forward refs natively.