bugfix in Draft entry editing
This commit is contained in:
parent
4d696f2253
commit
44bbb84d44
@ -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'))) {
|
||||||
|
@ -51,6 +51,7 @@ export default function EntryPageHOC(EntryPage) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...ownProps,
|
...ownProps,
|
||||||
|
...stateProps,
|
||||||
...returnObj,
|
...returnObj,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user