1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix(app): datatable global checkbox doesn't reflect the selected state (#470)

This commit is contained in:
James Player 2025-03-10 09:21:20 +13:00 committed by GitHub
parent 438b1f9815
commit b57855f20d
10 changed files with 110 additions and 18 deletions

View file

@ -42,6 +42,8 @@ export const Checkbox = forwardRef<HTMLInputElement, Props>(
resolvedRef = defaultRef;
}
// Need to check this on every render as the browser will always set the element's
// indeterminate state to false when the checkbox is clicked, even if the indeterminate prop hasn't changed
useEffect(() => {
if (resolvedRef === null || resolvedRef.current === null) {
return;
@ -50,7 +52,7 @@ export const Checkbox = forwardRef<HTMLInputElement, Props>(
if (typeof indeterminate !== 'undefined') {
resolvedRef.current.indeterminate = indeterminate;
}
}, [resolvedRef, indeterminate]);
});
return (
<div className="md-checkbox flex items-center" title={title || label}>