mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-16 03:38:45 +00:00
Move currentBrew/lastSavedBrew update after saving to common hook
This commit is contained in:
@@ -103,23 +103,13 @@ const EditPage = (props)=>{
|
||||
if(!res) return;
|
||||
|
||||
const updatedFields = {
|
||||
googleId : res.body.googleId ?? null,
|
||||
editId : res.body.editId,
|
||||
googleId : res.body.googleId ?? null, //TODO: investigate if we can set googleId:null in server/update instead of undefined
|
||||
editId : res.body.editId, //then, editPage can just apply res.body instead of breaking out these fields.
|
||||
shareId : res.body.shareId,
|
||||
version : res.body.version
|
||||
};
|
||||
|
||||
lastSavedBrew.current = {
|
||||
...brew,
|
||||
...updatedFields
|
||||
};
|
||||
|
||||
setCurrentBrew((prevBrew)=>({
|
||||
...prevBrew,
|
||||
...updatedFields
|
||||
}));
|
||||
|
||||
return res.body;
|
||||
return updatedFields;
|
||||
};
|
||||
|
||||
const onSaveSuccess = (savedBrew)=>{
|
||||
|
||||
Reference in New Issue
Block a user