From 44bbb84d4443733c94c6a9af4fc2595721f677a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1ssio=20Zen?= Date: Tue, 1 Nov 2016 14:31:04 -0200 Subject: [PATCH] bugfix in Draft entry editing --- src/containers/EntryPage.js | 5 +++-- src/containers/editorialWorkflow/EntryPageHOC.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/containers/EntryPage.js b/src/containers/EntryPage.js index b6fda5b1..235d57be 100644 --- a/src/containers/EntryPage.js +++ b/src/containers/EntryPage.js @@ -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'))) { diff --git a/src/containers/editorialWorkflow/EntryPageHOC.js b/src/containers/editorialWorkflow/EntryPageHOC.js index 50ad983a..b3010ab4 100644 --- a/src/containers/editorialWorkflow/EntryPageHOC.js +++ b/src/containers/editorialWorkflow/EntryPageHOC.js @@ -51,6 +51,7 @@ export default function EntryPageHOC(EntryPage) { return { ...ownProps, + ...stateProps, ...returnObj, }; }