Skip to content

Commit

Permalink
fix: "disappearing messages" dialog wrong value
Browse files Browse the repository at this point in the history
The bug was introduced in 0e0d0b8,
where we switched from the Blueprint's `RadioGroup` to our
custom `RadioGroup`, which had the bug where it would not
reflect the actual value if it was changed programmatically.
This commit fixes that bug.

The bug in `Radio` existed ever since its introduction.
The reason for using `defaultChecked` instead of `checked`
probably was the fact that React would complain that
"input doesn't have `onChange` listener set,
use `defaultChecked` instead".

I have ligtly checked that "disappearing messages"
is the only affected place.
  • Loading branch information
WofWca committed Nov 8, 2024
1 parent 1c57148 commit a120989
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Changed

## Fixed
- "Disappearing Messages" dialog not reflecting the actual current value #4327

<a id="1_48_0"></a>

Expand Down
7 changes: 5 additions & 2 deletions packages/frontend/src/components/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ export default function Radio({
id={id}
name={name}
type='radio'
onClick={() => onSelect && onSelect()}
// > change event fires
// > When a <input type="radio"> element is checked
// > (but not when unchecked);
onChange={() => onSelect && onSelect()}
value={value}
defaultChecked={Boolean(selected)}
checked={Boolean(selected)}
/>
<label
htmlFor={id}
Expand Down

0 comments on commit a120989

Please sign in to comment.