fix(dashboard): Cell behaviour in DataGrid (#8183)

This commit is contained in:
Kasper Fabricius Kristensen
2024-07-30 18:18:07 +02:00
committed by GitHub
parent fffd4f2b3b
commit 2967221e73
39 changed files with 2106 additions and 1033 deletions
@@ -0,0 +1,19 @@
import { MutableRefObject, Ref, RefCallback } from "react"
// Utility function to set multiple refs
function setRef<T>(ref: Ref<T> | undefined, value: T) {
if (typeof ref === "function") {
ref(value)
} else if (ref && "current" in ref) {
;(ref as MutableRefObject<T>).current = value
}
}
// Combining multiple refs into one
export const useCombinedRefs = <T,>(
...refs: (Ref<T> | undefined)[]
): RefCallback<T> => {
return (value: T) => {
refs.forEach((ref) => setRef(ref, value))
}
}