mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-24 03:02:56 +00:00
simpler answer
This commit is contained in:
@@ -312,8 +312,8 @@ const BrewRenderer = (props)=>{
|
|||||||
rowGap : `${displayOptions.rowGap}px`
|
rowGap : `${displayOptions.rowGap}px`
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderedStyle = useMemo(()=>renderStyle(), [props.style, props.themeBundle]);
|
const renderedStyle = useMemo(()=>renderStyle(), [props.style, centerPage, props.themeBundle]);
|
||||||
renderedPages = useMemo(()=>renderPages(), [props.text, displayOptions]);
|
renderedPages = useMemo(()=>renderPages(), [props.text, centerPage, displayOptions]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -45,20 +45,7 @@ const SharePage = (props)=>{
|
|||||||
console.log('error at fetching updated brew: ', error);
|
console.log('error at fetching updated brew: ', error);
|
||||||
});
|
});
|
||||||
if(response.ok && !!response.body.brew) {
|
if(response.ok && !!response.body.brew) {
|
||||||
const updatedBrew = response.body.brew;
|
setCurrentBrew(response.body.brew);
|
||||||
|
|
||||||
setCurrentBrew((prev)=>{
|
|
||||||
const changed = Object.keys(updatedBrew).filter((key)=>{
|
|
||||||
if(key === 'text' || key === 'textBin') {
|
|
||||||
return prev[key] !== updatedBrew[key];
|
|
||||||
}
|
|
||||||
return JSON.stringify(prev[key]) !== JSON.stringify(updatedBrew[key]);
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
...prev,
|
|
||||||
...updatedBrew
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user