Skip to content

Commit

Permalink
FIX Don't enter infinite loop when saving form (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Feb 8, 2023
1 parent e5a5ded commit 1bb852e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 1bb852e

Please sign in to comment.