fix file collection persist (#628)

This commit is contained in:
Shawn Erquhart 2017-09-26 16:20:03 -04:00 committed by Benaiah Mischenko
parent aa14a663e0
commit 3a7594722c
2 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import { closeEntry } from './editor';
import { BEGIN, COMMIT, REVERT } from 'redux-optimist';
import { currentBackend } from '../backends/backend';
import { getAsset } from '../reducers';
import { selectFields } from '../reducers/collections';
import { loadEntry } from './entries';
import { status, EDITORIAL_WORKFLOW } from '../constants/publishModes';
import { EditorialWorkflowError } from "../valueObjects/errors";
@ -237,7 +238,8 @@ export function persistUnpublishedEntry(collection, existingUnpublishedEntry) {
* Serialize the values of any fields with registered serializers, and
* update the entry and entryDraft with the serialized values.
*/
const serializedData = serializeValues(entryDraft.getIn(['entry', 'data']), collection.get('fields'));
const fields = selectFields(collection, entry.get('slug'));
const serializedData = serializeValues(entryDraft.getIn(['entry', 'data']), fields);
const serializedEntry = entry.set('data', serializedData);
const serializedEntryDraft = entryDraft.set('entry', serializedEntry);

View File

@ -5,6 +5,7 @@ import { closeEntry } from './editor';
import { currentBackend } from '../backends/backend';
import { getIntegrationProvider } from '../integrations';
import { getAsset, selectIntegration } from '../reducers';
import { selectFields } from '../reducers/collections';
import { createEntry } from '../valueObjects/Entry';
const { notifSend } = notifActions;
@ -276,7 +277,8 @@ export function persistEntry(collection) {
* Serialize the values of any fields with registered serializers, and
* update the entry and entryDraft with the serialized values.
*/
const serializedData = serializeValues(entryDraft.getIn(['entry', 'data']), collection.get('fields'));
const fields = selectFields(collection, entry.get('slug'));
const serializedData = serializeValues(entryDraft.getIn(['entry', 'data']), fields);
const serializedEntry = entry.set('data', serializedData);
const serializedEntryDraft = entryDraft.set('entry', serializedEntry);
dispatch(entryPersisting(collection, serializedEntry));