Move handleSplitMove to common hook

This commit is contained in:
Trevor Buckner
2026-09-12 12:50:27 -04:00
parent 804dedf1c2
commit 9441582aa3
4 changed files with 21 additions and 23 deletions
+6 -8
View File
@@ -62,8 +62,8 @@ const NewPage = (props)=>{
const [autoSaveEnabled, setAutoSaveEnabled] = useState(false);
const [warnUnsavedChanges, setWarnUnsavedChanges] = useState(true);
const editorRef = useRef(null);
const lastSavedBrew = useRef(_.cloneDeep(props.brew));
const editorRef = useRef(null);
const lastSavedBrew = useRef(_.cloneDeep(props.brew));
// const saveTimeout = useRef(null);
const warnUnsavedTimeout = useRef(null);
@@ -100,10 +100,6 @@ const NewPage = (props)=>{
window.history.replaceState({}, window.location.title, '/new/');
};
const handleSplitMove = ()=>{
editorRef.current.update();
};
const resetWarnUnsavedTimer = ()=>{
setTimeout(()=>setWarnUnsavedChanges(false), UNSAVED_WARNING_POPUP_TIMEOUT); // Hide the warning after 4 seconds
clearTimeout(warnUnsavedTimeout.current);
@@ -199,7 +195,8 @@ const NewPage = (props)=>{
</Navbar>
);
const {
const {
handleSplitMove,
handleBrewChange
} = useCommonEditPageFunctions({
setError,
@@ -221,7 +218,8 @@ const NewPage = (props)=>{
setUnsavedChanges,
trySave,
sandbox,
lastSavedBrew
lastSavedBrew,
editorRef
});
return (