Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Don't enter infinite loop when saving form #1329

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/src/components/UploadField/UploadField.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class UploadField extends Component {
}

componentDidMount() {
const { id, formSchemaFilesHash, data, actions, files } = this.props;
const { id, formSchemaFilesHash, data, value, actions, files } = this.props;

// This tracks changes to the underlying schema data for this field. It may be desirable in
// future to remove this and instead reset redux state whenever a "legacy" form triggers a
// PJAX load. See https://github.com/silverstripe/silverstripe-asset-admin/issues/960
const newFormSchemaFilesHash = md5(JSON.stringify(data.files)).toString();
const newFormSchemaFilesHash = md5(JSON.stringify(value.Files)).toString();

// If this is the first time this field has mounted, or the schema data has changed (typically
// caused by a PJAX load from saving a legacy non-react form), load the list of files from the
Expand Down Expand Up @@ -103,7 +103,7 @@ class UploadField extends Component {
actions: { uploadField: { setFormSchemaFilesHash, setFiles } }
} = this.props;

const newFormSchemaFilesHash = md5(JSON.stringify(data.files)).toString();
const newFormSchemaFilesHash = md5(JSON.stringify(value.Files)).toString();

// If the schema data has changed (typically caused by a PJAX load from saving a legacy
// non-react form), load the list of files from the schema data (data.files)
Expand Down