@ukhomeoffice/cop-react-form-renderer 5.24.1 → 5.24.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.
@@ -41,16 +41,9 @@ var CollectionPage = function CollectionPage(_ref) {
41
41
  _useState2 = _slicedToArray(_useState, 2),
42
42
  patch = _useState2[0],
43
43
  setPatch = _useState2[1];
44
- var _useState3 = (0, _react.useState)(_utils.default.CollectionPage.getData(page.collection.name, page.formData) || []),
45
- _useState4 = _slicedToArray(_useState3, 2),
46
- data = _useState4[0],
47
- setData = _useState4[1];
44
+ var data = _utils.default.CollectionPage.getData(page.collection.name, page.formData) || [];
48
45
  var currentCollectionName = page.collection.name.split('.').pop();
49
46
  var activeIndex = _utils.default.CollectionPage.getActiveIndex(page.collection.name, page.formData);
50
- (0, _react.useEffect)(function () {
51
- // This makes sure that the page is correctly populated on a refresh.
52
- setData(_utils.default.CollectionPage.getData(page.collection.name, page.formData) || []);
53
- }, [page.formData]);
54
47
 
55
48
  /**
56
49
  * Handle the state of the data directly within the page.
@@ -61,7 +54,7 @@ var CollectionPage = function CollectionPage(_ref) {
61
54
  var onPageChange = function onPageChange(_ref2) {
62
55
  var target = _ref2.target;
63
56
  _utils.default.CollectionPage.setData(currentPage.collection.name, target.value, page.formData);
64
- setData(target.value);
57
+ data = target.value;
65
58
  var parentCollection = page.collection.name.split('.').shift();
66
59
  // Because of the way that patch is applied to the submission data
67
60
  // later (in onPageAction.js), we have to record the entire top-level
@@ -136,7 +136,7 @@ var Collection = function Collection(_ref) {
136
136
  className: classes('title')
137
137
  }, config.label), value && value.map(function (item, index) {
138
138
  var _config$removeLocatio;
139
- var fullPath = "".concat(config.fullPath || config.fieldId, "[").concat(index, "]");
139
+ var fullPath = "".concat(config.full_path || config.fieldId, "[").concat(index, "]");
140
140
  var labelCount = (config.countOffset || 0) + index + 1;
141
141
  var itemTitle = _utils.default.interpolateString(labels.item, _objectSpread(_objectSpread({}, item), {}, {
142
142
  index: labelCount
@@ -184,7 +184,7 @@ var Collection = function Collection(_ref) {
184
184
  label: _utils.default.interpolateString(label, _objectSpread(_objectSpread({}, item), {}, {
185
185
  index: labelCount
186
186
  })),
187
- fullPath: "".concat(fullPath, ".").concat(component.fieldId)
187
+ full_path: "".concat(fullPath, ".").concat(component.fieldId)
188
188
  });
189
189
  })
190
190
  },
@@ -211,7 +211,7 @@ Collection.propTypes = {
211
211
  disableAddAndRemove: _propTypes.default.bool,
212
212
  id: _propTypes.default.string.isRequired,
213
213
  fieldId: _propTypes.default.string.isRequired,
214
- fullPath: _propTypes.default.string,
214
+ full_path: _propTypes.default.string,
215
215
  restrictHint: _propTypes.default.bool,
216
216
  item: _propTypes.default.arrayOf(_propTypes.default.shape({
217
217
  fieldId: _propTypes.default.string,
@@ -54,11 +54,11 @@ var Container = function Container(_ref) {
54
54
  var fullPath = "".concat(container.full_path || container.fieldId, ".").concat(options.fieldId);
55
55
  if (options.type === _models.ComponentTypes.CONTAINER) {
56
56
  return _utils.default.Container.show(_objectSpread(_objectSpread({}, options), {}, {
57
- fullPath: fullPath
57
+ full_path: fullPath
58
58
  }), formData);
59
59
  }
60
60
  return _utils.default.Component.show(_objectSpread(_objectSpread({}, options), {}, {
61
- fullPath: fullPath
61
+ full_path: fullPath
62
62
  }), formData);
63
63
  };
64
64
  var classes = _utils.default.classBuilder(DEFAULT_CLASS, [], container.className);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "5.24.1",
3
+ "version": "5.24.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",