bugfix in Draft entry editing

This commit is contained in:
Cássio Zen 2016-11-01 14:31:04 -02:00
parent 4d696f2253
commit 44bbb84d44
2 changed files with 4 additions and 2 deletions

View File

@ -38,17 +38,17 @@ class EntryPage extends React.Component {
};
componentDidMount() {
const { entry, newEntry, collection, slug, createEmptyDraft, loadEntry } = this.props;
const { entry, newEntry, collection, slug, loadEntry } = this.props;
if (newEntry) {
createEmptyDraft(collection);
} else {
loadEntry(entry, collection, slug);
this.createDraft(entry);
}
}
componentWillReceiveProps(nextProps) {
if (this.props.entry === nextProps.entry) return;
if (nextProps.entry && !nextProps.entry.get('isFetching')) {
this.createDraft(nextProps.entry);
} else if (nextProps.newEntry) {
@ -82,6 +82,7 @@ class EntryPage extends React.Component {
cancelEdit,
} = this.props;
if (entryDraft == null
|| entryDraft.get('entry') === undefined
|| (entry && entry.get('isFetching'))) {

View File

@ -51,6 +51,7 @@ export default function EntryPageHOC(EntryPage) {
return {
...ownProps,
...stateProps,
...returnObj,
};
}