Skip to content

Commit

Permalink
fix: Fix Checkbox not reverting indeterminate state when `current…
Browse files Browse the repository at this point in the history
…Value` changes
  • Loading branch information
diegohaz committed Apr 22, 2019
1 parent 5d4b476 commit 2ee7455
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/reakit/src/Checkbox/Checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ export function useCheckbox(
: ((options.currentValue || []) as any[]).indexOf(options.value) !== -1;

React.useEffect(() => {
if (ref.current && options.currentValue === "indeterminate") {
if (!ref.current) return;

if (options.currentValue === "indeterminate") {
ref.current.indeterminate = true;
} else if (ref.current.indeterminate) {
ref.current.indeterminate = false;
}
}, [options.currentValue]);

Expand Down

0 comments on commit 2ee7455

Please sign in to comment.