diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-20 11:37:31 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-20 11:37:31 +0000 |
| commit | aa86729f9a2ab95346a2851e3837de1c367aae17 (patch) | |
| tree | b601b18b6724f2fb449c7fa9ea50cbd652a8077d /components/data-table | |
| parent | 95bbe9c583ff841220da1267630e7b2025fc36dc (diff) | |
(대표님) 20250620 작업사항
Diffstat (limited to 'components/data-table')
| -rw-r--r-- | components/data-table/use-table-presets.tsx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/components/data-table/use-table-presets.tsx b/components/data-table/use-table-presets.tsx index 5e641762..f9ecda2a 100644 --- a/components/data-table/use-table-presets.tsx +++ b/components/data-table/use-table-presets.tsx @@ -288,17 +288,19 @@ export function useTablePresets<TData>( }, [mutate]) // 클라이언트 상태 업데이트 (컬럼 가시성, 핀 등) - const updateClientState = useCallback(async (newClientState: Partial<TableSettings<TData>>) => { - if (!activePreset) return - - const updatedSettings = { - ...activePreset.settings, - ...newClientState - } - - await updatePreset(activePreset.id, updatedSettings) - }, [activePreset, updatePreset]) + const updateClientState = useCallback( + async (newClientState: Partial<TableSettings<TData>>) => { + if (!activePreset) return; + + + const prev = activePreset.settings; + const next = { ...prev, ...newClientState }; + + await updatePreset(activePreset.id, next); + }, + [activePreset, updatePreset, tableId] // ← tableId 도 의존성에 넣어 둡니다 + ); // URL 변경 감지 및 미저장 변경사항 체크 useEffect(() => { if (!isClient || !presets || !activePreset) return |
