@homefile/components-v2 2.40.5 → 2.40.7

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.
@@ -4,7 +4,8 @@ import { firstHomeProxy, addressProxy } from '../../proxies';
4
4
  import { useAddressStored } from '../../hooks';
5
5
  import { useRadioGroup } from '@chakra-ui/react';
6
6
  export const useAddHouseContent = (values, callback) => {
7
- const { fields, validations } = addressProxy;
7
+ // removing below and moving to when they are needed so no stale proxy
8
+ // const { fields, validations } = addressProxy
8
9
  const firstHome = firstHomeProxy;
9
10
  const { handleValidation } = useAddressStored({});
10
11
  const handleNameChange = (event) => {
@@ -22,6 +23,7 @@ export const useAddHouseContent = (values, callback) => {
22
23
  return '';
23
24
  };
24
25
  const cleanStores = () => {
26
+ const { fields } = addressProxy;
25
27
  const addressKeys = Object.keys(fields);
26
28
  addressKeys.forEach((key) => (fields[key] = ''));
27
29
  firstHome.name = '';
@@ -30,12 +32,14 @@ export const useAddHouseContent = (values, callback) => {
30
32
  firstHome.searchRecords = true;
31
33
  };
32
34
  const resetValidations = () => {
35
+ const { validations } = addressProxy;
33
36
  const keys = Object.keys(validations);
34
37
  keys.forEach((key) => (validations[key] = true));
35
38
  firstHome.isNameValid = true;
36
39
  };
37
40
  const fullfillStores = (values) => {
38
41
  var _a;
42
+ const { fields } = addressProxy;
39
43
  if (values) {
40
44
  const addressKeys = Object.keys(values).filter((key) => key !== 'name');
41
45
  addressKeys.forEach((key) => { var _a, _b; return (fields[key] = (_b = (_a = values[key]) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''); });
@@ -44,7 +48,7 @@ export const useAddHouseContent = (values, callback) => {
44
48
  }
45
49
  };
46
50
  const handleSubmit = () => {
47
- const hasError = Object.values(validations).includes(false);
51
+ const { fields, validations } = addressProxy;
48
52
  if (!firstHome.name)
49
53
  firstHome.isNameValid = false;
50
54
  handleValidation('city');
@@ -52,6 +56,7 @@ export const useAddHouseContent = (values, callback) => {
52
56
  handleValidation('street');
53
57
  handleValidation('number');
54
58
  handleValidation('zip');
59
+ const hasError = Object.values(validations).includes(false);
55
60
  if (!hasError && firstHome.isNameValid) {
56
61
  callback === null || callback === void 0 ? void 0 : callback(Object.assign(Object.assign({}, fields), { externalLink: firstHome.externalLink, name: firstHome.name, isOwner: firstHome.isOwner, searchRecords: firstHome.searchRecords }));
57
62
  cleanStores();
@@ -17,6 +17,7 @@ export const addressProxy = proxy({
17
17
  isZipValid: true,
18
18
  },
19
19
  setFields(fields) {
20
- this.fields = fields;
20
+ // this.fields = fields
21
+ Object.assign(this.fields, fields);
21
22
  },
22
23
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.40.5",
3
+ "version": "2.40.7",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",