fix: (regression 0.55.0) admin/plugins: some options dialog could be unstable (eg: upload-quota)

Massimo Melina committed Jan 5, 2025 at 20:05 UTC eccfcf9d450dde3653125f8d142fe9baabe9c6f0
1 file changed +2 -1
admin/src/DataTable.ts
+2 -1
@@ -7,6 +7,7 @@ import _ from 'lodash'
7 import { Center, Flex } from './mui'
8 import { SxProps } from '@mui/system'
9 import { state, updateStateObject } from './state'
10 +import { useDebounce } from 'usehooks-ts'
11
12 const ACTIONS = 'Actions'
13
@@ -95,7 +96,7 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
96 return ret
97 }, [columns, actions, actionsLength])
98 const sizeGrid = useGetSize()
98 - const width = sizeGrid.w || 0
99 + const width = useDebounce(sizeGrid.w || 0, 500) // stabilize width
100 const hideCols = useMemo(() => {
101 const fields = onlyTruthy(manipulatedColumns.map(({ field, hideUnder, hidden }) =>
102 (hidden || hideUnder && width < (typeof hideUnder === 'number' ? hideUnder : theme.breakpoints.values[hideUnder]))