Очистка неиспользуемого и оптимизация

This commit is contained in:
2025-07-22 08:01:32 +03:00
parent 3275cdc661
commit 3a1bb42aee
9 changed files with 62 additions and 906 deletions

View File

@@ -20,6 +20,10 @@ export const useSheetAutoSave = (
options: UseSheetAutoSaveOptions = {}
) => {
console.log('getAllModifiedCells', getAllModifiedCells())
const memoizedGetAllModifiedCells = useCallback(getAllModifiedCells, [
getAllModifiedCells,
])
const { templateId, autoSaveDelay = 2000, enableAutoSave = true } = options
// Состояние
@@ -171,7 +175,7 @@ export const useSheetAutoSave = (
if (shouldAutoSave) {
console.log('✅ Выполняем автосохранение для ревизии:', debouncedRevision)
performSave(getAllModifiedCells())
performSave(memoizedGetAllModifiedCells())
}
}, [
enableAutoSave,
@@ -180,15 +184,15 @@ export const useSheetAutoSave = (
isCalculating,
isSaving,
templateId,
getAllModifiedCells,
memoizedGetAllModifiedCells,
performSave,
])
// Ручное сохранение
const manualSave = useCallback(() => {
const currentData = getAllModifiedCells()
const currentData = memoizedGetAllModifiedCells()
performSave(currentData)
}, [getAllModifiedCells, performSave])
}, [memoizedGetAllModifiedCells, performSave])
// Функция загрузки сохраненных листов
const loadSavedSheets = useCallback((): Record<
@@ -226,7 +230,7 @@ export const useSheetAutoSave = (
loadSheets,
// Утилиты
getCurrentData: getAllModifiedCells,
getCurrentData: memoizedGetAllModifiedCells,
clearError: () => setLastSaveError(null),
}
}