diff --git a/src/utils/useLocalColumns.ts b/src/utils/useLocalColumns.ts index 946f277..20d6fba 100644 --- a/src/utils/useLocalColumns.ts +++ b/src/utils/useLocalColumns.ts @@ -56,11 +56,7 @@ function useLocalColumns>({ const [localColumns, setLocalColumns] = React.useState(initLocalColumns); useEffect(() => { - if (!localColumns?.length) { - setLocalColumns(columnsProp); - } else { - setLocalColumns(initLocalColumns()); - } + setLocalColumns(initLocalColumns()); // eslint-disable-next-line react-hooks/exhaustive-deps }, [columnsProp]); @@ -70,7 +66,7 @@ function useLocalColumns>({ React.useEffect(() => { const { persistenceType, persistenceKey } = columnsState || {}; - if (!persistenceKey || !persistenceType || !resizableColumns) { + if (!persistenceKey || !persistenceType || !resizableColumns?.length) { return; } if (typeof window === 'undefined') return; @@ -92,7 +88,8 @@ function useLocalColumns>({ } catch (error) { console.error(error); } - }, [columnsState, resizableColumns]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [resizableColumns]); /** * reset