1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 12:25:22 +02:00

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

This commit is contained in:
James Player 2025-03-17 15:35:51 +13:00 committed by GitHub
parent b0de6d41b7
commit d5981a4be9
10 changed files with 114 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}>