Move clearError to common hook

This commit is contained in:
Trevor Buckner
2026-09-14 19:11:14 +00:00
parent 4dd5c778ac
commit 13731f5771
4 changed files with 9 additions and 15 deletions
+1 -5
View File
@@ -247,11 +247,6 @@ const EditPage = (props)=>{
</Nav.item>
);
const clearError = ()=>{
setError(null);
setIsSaving(false);
};
const renderNavbar = ()=>{
return <Navbar>
<Nav.section>
@@ -282,6 +277,7 @@ const EditPage = (props)=>{
handleSplitMove,
handleBrewChange,
toggleAutoSave,
clearError,
trySave
} = useCommonEditPageFunctions({
saveGoogle,
+1 -5
View File
@@ -112,11 +112,6 @@ const HomePage =(props)=>{
return <Nav.item className='save saved'>saved</Nav.item>;
};
const clearError = ()=>{
setError(null);
setIsSaving(false);
};
const renderNavbar = ()=>{
return <Navbar ver={props.ver}>
<Nav.section>
@@ -137,6 +132,7 @@ const HomePage =(props)=>{
resetWarnUnsavedTimer,
handleSplitMove,
handleBrewChange,
clearError,
trySave
} = useCommonEditPageFunctions({
saveGoogle,
+1 -5
View File
@@ -156,11 +156,6 @@ const NewPage = (props)=>{
return <Nav.item className='save saved'>saved</Nav.item>;
};
const clearError = ()=>{
setError(null);
setIsSaving(false);
};
const renderNavbar = ()=>(
<Navbar>
<Nav.section>
@@ -185,6 +180,7 @@ const NewPage = (props)=>{
resetWarnUnsavedTimer,
handleSplitMove,
handleBrewChange,
clearError,
trySave
} = useCommonEditPageFunctions({
saveGoogle,
@@ -121,6 +121,11 @@ export default function useCommonEditPageFunctions(dependencies) {
setWarnUnsavedChanges(autoSaveEnabled);
};
const clearError = ()=>{
setError(null);
setIsSaving(false);
};
const trySave = useEffectEvent((forceSave = false, hasChanges = true, saveToGoogle = false)=>{
clearTimeout(saveTimeout.current);
if(isSaving) return;
@@ -145,6 +150,7 @@ export default function useCommonEditPageFunctions(dependencies) {
handleSplitMove,
handleBrewChange,
toggleAutoSave,
clearError,
trySave,
}
}