mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-11 04:42:42 +00:00
Rearrange so loading from one doesn't override the other
This commit is contained in:
@@ -64,18 +64,17 @@ const NewPage = createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount : function() {
|
componentDidMount : function() {
|
||||||
const brewStorage = localStorage.getItem(BREWKEY);
|
const brewStorage = localStorage.getItem(BREWKEY);
|
||||||
if(!this.props.brew.text && brewStorage){
|
|
||||||
this.setState({
|
|
||||||
brew : { text: brewStorage }
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const styleStorage = localStorage.getItem(STYLEKEY);
|
const styleStorage = localStorage.getItem(STYLEKEY);
|
||||||
if(!this.props.brew.style && styleStorage){
|
|
||||||
|
if(!this.props.brew.text || !this.props.brew.style){
|
||||||
this.setState({
|
this.setState({
|
||||||
brew : { style: styleStorage }
|
brew : {
|
||||||
|
text : this.props.brew.text || (brewStorage ?? ''),
|
||||||
|
style : this.props.brew.style || (styleStorage ?? undefined)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
this.setState((prevState)=>({
|
this.setState((prevState)=>({
|
||||||
htmlErrors : Markdown.validate(prevState.brew.text)
|
htmlErrors : Markdown.validate(prevState.brew.text)
|
||||||
|
|||||||
Reference in New Issue
Block a user