feat(ui): add ToggleButton and SortButton components#1165
feat(ui): add ToggleButton and SortButton components#1165guoda-puidokaite merged 9 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: f04d81d The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
|
andypf
left a comment
There was a problem hiding this comment.
Looks good to me. However, I found two points that could potentially be improved.
|
I'm curious why we have to make Update: |
|
One more case to consider, if the list of |
The reason for making the components controlled is that in actual usage developers often want to use it in a controlled fashion (i.e. being able to set the value initially and also update the value later). We used to have more components that were uncontrolled, or could be either controlled or uncontrolled. But in practice it often produced problems. If you have an actual uncontrolled component and try to change the value after the initial mount you'll get an error message from React because this is not allowed. So our solution was to make all components controlled (for React) but some of them can behave like an uncontrolled component if the developer doesn't want to update state manually. |
Hey, I was thinking - doesn't React already have a |
I see your point but IMO the overhead to maintain a hybrid component is huge. Specially for the use case and the user experience of this specific |
Yes, you're right. We were thinking of DX here and wanted to offer developers the best of both worlds essentially. The way we do it currently allows people to use the components completely controlled or uncontrolled or in a weird hybrid way that normally isn't possible. But it does make the components more complex and maybe it's completely unnecessary, as you pointed out, since people will have their own app state anyway and then the internal component state is just duplicated information. We will discuss this and make a decision how we want to do this going forward. |

Summary
ToggleButtonandSortButtoncomponents.Card.Changes Made
Checklist
Testing
Reviewers: Please see
Quality Assurancesection in the main ticket. 🙏PR Manifesto
Review the PR Manifesto for best practises.