fix: make Trust toggle a controlled component#345
Merged
calvadev merged 1 commit intoshopstr-eng:mainfrom Apr 6, 2026
Merged
Conversation
|
@23bsm038-Mahi is attempting to deploy a commit to the shopstr-eng Team on Vercel. A member of the Team first needs to authorize it. |
kaihere14
reviewed
Apr 5, 2026
Contributor
kaihere14
left a comment
There was a problem hiding this comment.
Nice job. Switching from onClick to onValueChange is right, because onClick is not getting the new boolean value so the toggle was just being uncontrolled. When binding isSelected to {wotFilter}, it makes sure that the UI will reflect the actual state. Nicely solved.
Contributor
|
LGTM |
calvadev
approved these changes
Apr 6, 2026
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.
Summary
Make the Trust toggle a controlled component by binding it to the existing
wotFilterstate.Problem
The Trust filter switch was updating state on interaction but was not receiving the current state as a prop. This could cause the UI to become out of sync with the actual filter state after re-renders.
Changes
isSelected={wotFilter}to the Switch componentonClickwithonValueChangefor proper controlled behaviorWhy this matters
Ensures the toggle UI always reflects the actual filter state, improving reliability and user experience.
Scope
Testing