-
Notifications
You must be signed in to change notification settings - Fork 4k
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
refactor(Components): use a class if there are event handlers #619
Conversation
Current coverage is 100% (diff: 100%)@@ master #619 diff @@
====================================
Files 119 119
Lines 1913 1881 -32
Methods 0 0
Messages 0 0
Branches 0 0
====================================
- Hits 1913 1881 -32
Misses 0 0
Partials 0 0
|
|
||
export default Form | ||
handleRef = (c) => (this._form = this._form || c) |
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.
Please, pay attention there, it looks I open there pandora box.
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.
This seems correct for now. Eventually, the serializer will not be DOM dependent and this ref will go away. I would suggest just setting it and avoiding the developer indirection however.
ref={c => (this._form = this._form || c)}
|
Rating is dependent on the index and we're essentially
That being said, the |
As another hateful solution: we can add class |
I'll removed |
😆 This looks good to me but I'll defer to @levithomason for a final review. I'm going to wait to update the custom proptype PR until this gets merged because there are gonna be a ton of conflicts due to renaming/moving stuff. |
Actually, looks like there are a few more that I missed
|
I copied this to #607. |
|
||
export default Form | ||
handleRef = (c) => (this._form = this._form || c) |
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.
This seems correct for now. Eventually, the serializer will not be DOM dependent and this ref will go away. I would suggest just setting it and avoiding the developer indirection however.
ref={c => (this._form = this._form || c)}
Looks good overall, merging! Handling ConflictsLet's try to coordinate larger refactors / moving things around going forward. This way we can avoid big conflicts between PRs. When lots of refactoring is required, I'd like to try to clear any major PRs (such as #618) before embarking. This is partly why I've also requested https://github.com/TechnologyAdvice/stardust/pull/587 to be split up. It is easier to manage and less likely to break stuff if we go in bite sized moves. AccordionYea, this is an ugly component. Partly due to the SUI markup, but it also hasn't been visited in some time. It has some issues as well #559, and some missing features #499. Needs some love for sure. RatingLet's avoid using the DOM for reading data. I like the I don't think we should expose this to the user though. It can probably even live at the top of the Rating file. Then, it can have a proper click/enter handler that can call back with the event and it's props. Since this isn't a public component, we'll be in control of what props we pass it, like the (e, props) Digression :/Not to derail the convo, but I've considered whether or not we just always callback with props on all handlers: |
Functional components that need to be turned into a class (Found via grep:
const handle
):