@comicrelief/component-library 5.8.2 → 5.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,12 @@ var CheckAnswer = function CheckAnswer(_ref) {
28
28
  if (e.target.checked) {
29
29
  newVal = e.target.value === 'yes' ? e.target.value : 'no';
30
30
  } else {
31
- newVal = '';
31
+ newVal = ''; // To ensure we're not letting invalid values get passed, reset any associated fields:
32
+
33
+ var theseFields = _AssociatedFields.default[name];
34
+ theseFields.forEach(function (fieldName) {
35
+ setValue(fieldName, '');
36
+ });
32
37
  } // Update the checkbox field itself
33
38
 
34
39
 
@@ -39,8 +44,9 @@ var CheckAnswer = function CheckAnswer(_ref) {
39
44
  var reValidate = !mpValidationOptions[name][newVal];
40
45
 
41
46
  if (reValidate) {
42
- var theseFields = _AssociatedFields.default[name];
43
- theseFields.forEach(function (fieldName) {
47
+ var _theseFields = _AssociatedFields.default[name];
48
+
49
+ _theseFields.forEach(function (fieldName) {
44
50
  clearErrors(fieldName);
45
51
  });
46
52
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "5.8.2",
4
+ "version": "5.8.3",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -19,6 +19,12 @@ const CheckAnswer = ({
19
19
  newVal = e.target.value === 'yes' ? e.target.value : 'no';
20
20
  } else {
21
21
  newVal = '';
22
+
23
+ // To ensure we're not letting invalid values get passed, reset any associated fields:
24
+ const theseFields = AssociatedFields[name];
25
+ theseFields.forEach(fieldName => {
26
+ setValue(fieldName, '');
27
+ });
22
28
  }
23
29
 
24
30
  // Update the checkbox field itself