Skip to content

Commit

Permalink
YDA-5848: fix 'metadata-form clears on pressing Enter' issue
Browse files Browse the repository at this point in the history
Setting the state of formContext in onChange event of metadata-form prevents resetting form fields on pressing 'Enter'.
  • Loading branch information
kaur16 authored Aug 16, 2024
1 parent 441eafa commit 8def5c3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
10 changes: 10 additions & 0 deletions research/metadata-form/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,16 @@ class YodaForm extends React.Component {
}

onChange(form) {
// Turn save mode off.
saving = false;
const formContext = { saving: false };

this.setState({
formData: form.formData,
formContext: formContext
});

// Update form completeness bar
updateCompleteness();
}

Expand Down
2 changes: 1 addition & 1 deletion research/static/research/js/metadata-form.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions vault/metadata-form/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,16 @@ class YodaForm extends React.Component {
}

onChange(form) {
// Turn save mode off.
saving = false;
const formContext = { saving: false };

this.setState({
formData: form.formData,
formContext: formContext
});

// Update form completeness bar
updateCompleteness();
}

Expand Down
6 changes: 3 additions & 3 deletions vault/static/vault/js/metadata-form.js

Large diffs are not rendered by default.

0 comments on commit 8def5c3

Please sign in to comment.