mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-25 22:22:58 +00:00
Move "unsaved changes" check to common hook
This commit is contained in:
@@ -88,7 +88,9 @@ const HomePage =(props)=>{
|
||||
setWarnUnsavedChanges,
|
||||
trySaveRef,
|
||||
unsavedChangesRef,
|
||||
sandbox
|
||||
setUnsavedChanges,
|
||||
sandbox,
|
||||
lastSavedBrew
|
||||
});
|
||||
|
||||
useEffect(()=>{
|
||||
@@ -108,13 +110,6 @@ const HomePage =(props)=>{
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
const hasChange = !_.isEqual(currentBrew, lastSavedBrew.current);
|
||||
setUnsavedChanges(hasChange);
|
||||
|
||||
if(autoSaveEnabled) trySave(false, hasChange);
|
||||
}, [currentBrew]);
|
||||
|
||||
const handleSplitMove = ()=>{
|
||||
editorRef.current.update();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user