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

View File

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