Skip to content

Commit fd5e633

Browse files
committed
pass storeKey down from RepeatableFieldList to SubFieldWrapper
1 parent a1a10e3 commit fd5e633

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

ui/js/dfv/src/components/field-wrapper/repeatable-field-list.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const RepeatableFieldList = ( {
5757
allPodFieldsMap,
5858
setFullValue,
5959
setHasBlurred,
60+
storeKey,
6061
} ) => {
6162
// Helper functions for setting, moving, adding, and deleting the value
6263
// or subvalues.
@@ -203,6 +204,7 @@ const RepeatableFieldList = ( {
203204
/>
204205
) : null }
205206
key={ `${ fieldConfig.name }-${ index }` }
207+
storeKey={ storeKey }
206208
/>
207209
);
208210
} ) }
@@ -276,6 +278,11 @@ RepeatableFieldList.propTypes = {
276278
* Function to call when a field has blurred.
277279
*/
278280
setHasBlurred: PropTypes.func.isRequired,
281+
282+
/**
283+
* Redux store key.
284+
*/
285+
storeKey: PropTypes.string.isRequired,
279286
};
280287

281288
export default RepeatableFieldList;

ui/js/dfv/src/components/field-wrapper/subfield-wrapper.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const SubfieldWrapper = ( {
4040
allPodFieldsMap,
4141
setValue,
4242
setHasBlurred,
43+
storeKey,
4344
} ) => {
4445
// Adjust the `name`/`htmlAttr[name]` and IDs
4546
// for repeatable fields, so that each value gets saved.
@@ -70,7 +71,8 @@ const SubfieldWrapper = ( {
7071
const [ validationMessages, addValidationRules ] = useValidation(
7172
[],
7273
value,
73-
subfieldConfig.name
74+
subfieldConfig.name,
75+
storeKey
7476
);
7577

7678
// Set up useSortable hook
@@ -189,7 +191,7 @@ SubfieldWrapper.propTypes = {
189191

190192
/**
191193
* Pod slug being edited.
192-
*/
194+
*/
193195
podName: PropTypes.string,
194196

195197
/**
@@ -210,8 +212,13 @@ SubfieldWrapper.propTypes = {
210212

211213
/**
212214
* Function to call when a field has blurred.
213-
*/
215+
*/
214216
setHasBlurred: PropTypes.func.isRequired,
217+
218+
/**
219+
* Redux store key.
220+
*/
221+
storeKey: PropTypes.string.isRequired,
215222
};
216223

217224
export default SubfieldWrapper;

ui/js/dfv/src/store/store.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const initEditPodStore = ( config, storeKey = '' ) => {
8484
},
8585
...omit( config, [ 'fieldTypes', 'relatedObjects' ] ),
8686
};
87-
console.log({initEditPodStore:initialState});
8887
return initStore( initialState, storeKey );
8988
};
9089

@@ -97,7 +96,6 @@ export const initPodStore = ( config = {}, initialValues = {}, storeKey = '' ) =
9796
...omit( config, [ 'fieldTypes', 'relatedObjects' ] ),
9897
currentPod: initialValues,
9998
};
100-
console.log({initPodStore:initialState});
10199

102100
return initStore( initialState, storeKey );
103101
};

0 commit comments

Comments
 (0)