fix: duplicate entry (#3563)

This commit is contained in:
Bartholomew 2020-04-09 12:44:06 +01:00 committed by GitHub
parent 0761ffa3f2
commit 1d88b15de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 1 deletions

View File

@ -406,6 +406,7 @@ export function persistUnpublishedEntry(collection: Collection, existingUnpublis
}), }),
); );
dispatch(unpublishedEntryPersisted(collection, transactionID, newSlug)); dispatch(unpublishedEntryPersisted(collection, transactionID, newSlug));
if (!existingUnpublishedEntry) return dispatch(loadUnpublishedEntry(collection, newSlug));
} catch (error) { } catch (error) {
dispatch( dispatch(
notifSend({ notifSend({

View File

@ -762,6 +762,7 @@ export function persistEntry(collection: Collection) {
dispatch(loadMedia()); dispatch(loadMedia());
} }
dispatch(entryPersisted(collection, serializedEntry, slug)); dispatch(entryPersisted(collection, serializedEntry, slug));
if (serializedEntry.get('newRecord')) return dispatch(loadEntry(collection, slug));
}) })
.catch((error: Error) => { .catch((error: Error) => {
console.error(error); console.error(error);

View File

@ -177,7 +177,6 @@ export class Editor extends React.Component {
const newSlug = this.props.entryDraft && this.props.entryDraft.getIn(['entry', 'slug']); const newSlug = this.props.entryDraft && this.props.entryDraft.getIn(['entry', 'slug']);
if (!prevProps.slug && newSlug && this.props.newEntry) { if (!prevProps.slug && newSlug && this.props.newEntry) {
navigateToEntry(prevProps.collection.get('name'), newSlug); navigateToEntry(prevProps.collection.get('name'), newSlug);
this.props.loadEntry(this.props.collection, newSlug);
} }
if (!prevProps.localBackup && this.props.localBackup) { if (!prevProps.localBackup && this.props.localBackup) {