mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-28 09:12:45 +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() {
|
||||
const brewStorage = localStorage.getItem(BREWKEY);
|
||||
if(!this.props.brew.text && brewStorage){
|
||||
this.setState({
|
||||
brew : { text: brewStorage }
|
||||
});
|
||||
};
|
||||
const brewStorage = localStorage.getItem(BREWKEY);
|
||||
const styleStorage = localStorage.getItem(STYLEKEY);
|
||||
if(!this.props.brew.style && styleStorage){
|
||||
|
||||
if(!this.props.brew.text || !this.props.brew.style){
|
||||
this.setState({
|
||||
brew : { style: styleStorage }
|
||||
brew : {
|
||||
text : this.props.brew.text || (brewStorage ?? ''),
|
||||
style : this.props.brew.style || (styleStorage ?? undefined)
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
this.setState((prevState)=>({
|
||||
htmlErrors : Markdown.validate(prevState.brew.text)
|
||||
|
||||
Reference in New Issue
Block a user