@open-tender/utils 0.1.153 → 0.1.154
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.
|
@@ -42,16 +42,18 @@ const useProfileForm = (profile, loading, error, update, callback, optionalField
|
|
|
42
42
|
const [data, setData] = (0, react_1.useState)(profile);
|
|
43
43
|
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
44
44
|
const [errors, setErrors] = (0, react_1.useState)({});
|
|
45
|
-
const toRemove =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
|
|
45
|
+
const toRemove = (0, react_1.useMemo)(() => {
|
|
46
|
+
const removed = [];
|
|
47
|
+
if (optionalFields && !optionalFields.includes('birth_date'))
|
|
48
|
+
removed.push('birth_date');
|
|
49
|
+
if (optionalFields && !optionalFields.includes('gender'))
|
|
50
|
+
removed.push('gender');
|
|
51
|
+
return removed;
|
|
52
|
+
}, [optionalFields]);
|
|
53
|
+
// const fields = allFields.filter((i) => !toRemove.includes(i.name))
|
|
54
|
+
const fields = (0, react_1.useMemo)(() => {
|
|
55
|
+
return allFields.filter(i => !toRemove.includes(i.name));
|
|
56
|
+
}, [toRemove]);
|
|
55
57
|
(0, react_1.useEffect)(() => {
|
|
56
58
|
if (loading === 'idle') {
|
|
57
59
|
setSubmitting(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef, useState, useEffect } from 'react';
|
|
1
|
+
import { useRef, useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { makeBirthDate, makeFormErrors, makePhone, slashesToDashes } from '../utils';
|
|
3
3
|
export const genderOptions = [
|
|
4
4
|
{ name: 'not specified', value: 'DECLINED' },
|
|
@@ -39,16 +39,18 @@ export const useProfileForm = (profile, loading, error, update, callback, option
|
|
|
39
39
|
const [data, setData] = useState(profile);
|
|
40
40
|
const [submitting, setSubmitting] = useState(false);
|
|
41
41
|
const [errors, setErrors] = useState({});
|
|
42
|
-
const toRemove =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
|
|
42
|
+
const toRemove = useMemo(() => {
|
|
43
|
+
const removed = [];
|
|
44
|
+
if (optionalFields && !optionalFields.includes('birth_date'))
|
|
45
|
+
removed.push('birth_date');
|
|
46
|
+
if (optionalFields && !optionalFields.includes('gender'))
|
|
47
|
+
removed.push('gender');
|
|
48
|
+
return removed;
|
|
49
|
+
}, [optionalFields]);
|
|
50
|
+
// const fields = allFields.filter((i) => !toRemove.includes(i.name))
|
|
51
|
+
const fields = useMemo(() => {
|
|
52
|
+
return allFields.filter(i => !toRemove.includes(i.name));
|
|
53
|
+
}, [toRemove]);
|
|
52
54
|
useEffect(() => {
|
|
53
55
|
if (loading === 'idle') {
|
|
54
56
|
setSubmitting(false);
|
package/package.json
CHANGED