Move "unsaved changes" check to common hook

This commit is contained in:
Trevor Buckner
2026-09-11 23:21:21 -04:00
parent b116730925
commit b9ae2cd16c
4 changed files with 22 additions and 25 deletions
+3 -8
View File
@@ -84,6 +84,7 @@ const EditPage = (props)=>{
const {
handleBrewChange
} = useCommonEditPageFunctions({
saveGoogle,
setError,
setThemeBundle,
HTMLErrors,
@@ -101,8 +102,9 @@ const EditPage = (props)=>{
setWarnUnsavedChanges,
trySaveRef,
unsavedChangesRef,
setUnsavedChanges,
sandbox,
saveGoogle
lastSavedBrew
});
useEffect(()=>{
@@ -110,13 +112,6 @@ const EditPage = (props)=>{
unsavedChangesRef.current = unsavedChanges;
});
useEffect(()=>{
const hasChange = !_.isEqual(currentBrew, lastSavedBrew.current);
setUnsavedChanges(hasChange);
if(autoSaveEnabled) trySave(false, hasChange, saveGoogle);
}, [currentBrew]);
const handleSplitMove = ()=>{
editorRef.current?.update();
};