refactor: convert ToggleButton and ToggleButtonGroup to functional components#6913
Merged
tujoworker merged 17 commits intov11from Apr 5, 2026
Merged
refactor: convert ToggleButton and ToggleButtonGroup to functional components#6913tujoworker merged 17 commits intov11from
tujoworker merged 17 commits intov11from
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
Branch Preview URL (stable): Deployment URL (unique): |
commit: |
4a2cc22 to
1e7bda2
Compare
7a29a0f to
7582a09
Compare
tujoworker
approved these changes
Mar 24, 2026
9b1829b to
b771d1e
Compare
H3: Use ownProps.value ?? '' in callOnChange to match the class component
behavior where this.props.value had a default of '' from defaultProps.
M3: Copy the values array before push/splice to avoid direct state mutation.
The original class component extended React.PureComponent which provides shallow prop comparison. React.memo is the functional equivalent.
…tContext - ToggleButton: add ownPropsRef, groupContextRef, checkedRef; update callOnChange and onClickHandler to use refs instead of closure values, removing ownProps/groupContext/checked from dependency arrays - ToggleButtonGroup: add ownPropsRef, valuesRef; update onChangeHandler to use refs; extract setContext into a stable useCallback
…Button Explains why onlyMergeExistingProps: true is needed to prevent context props from leaking to DOM attributes.
…tonGroup - ToggleButton: restore proper onChange type (ToggleButtonChangeEvent) instead of generic (...args: unknown[]) => void - ToggleButtonGroupContext: use specific value type instead of unknown in onChange - ToggleButtonGroup: add back ToggleButtonGroupChangeEvent type and use it for onChange prop
…, rename tmp to prevContext
b771d1e to
a96bcd7
Compare
Member
|
Did test things manually. Worked as expected/before. |
tujoworker
added a commit
that referenced
this pull request
Apr 5, 2026
…mponents (#6913) Co-authored-by: Tobias Høegh <tobias@tujo.no>
tujoworker
added a commit
that referenced
this pull request
Apr 5, 2026
…mponents (#6913) Co-authored-by: Tobias Høegh <tobias@tujo.no>
tujoworker
added a commit
that referenced
this pull request
Apr 5, 2026
…mponents (#6913) Co-authored-by: Tobias Høegh <tobias@tujo.no>
tujoworker
added a commit
that referenced
this pull request
Apr 6, 2026
…mponents (#6913) Co-authored-by: Tobias Høegh <tobias@tujo.no>
tujoworker
added a commit
that referenced
this pull request
Apr 6, 2026
…mponents (#6913) Co-authored-by: Tobias Høegh <tobias@tujo.no>
tujoworker
added a commit
that referenced
this pull request
Apr 6, 2026
…mponents (#6913) Co-authored-by: Tobias Høegh <tobias@tujo.no>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.