Hi,
I am trying to create alias mappings for module fields that are located in a repeated field group but have been unsucessfull so far. The new field that reference the old one does not seem to get included into the modules field values. I have no issue creating alias mappings for fields NOT inside a repeated field group.
I have done my best to follow this documentation regarding alias mapping:
I get no error message in either the page editor or on a published page that gives any insight to what might be wrong
Here is a slimed down version of our people cards module that highlights the issue:
export function Component({ fieldValues }) {
const { people_cards } = fieldValues
return (
<ModuleWrapper fieldValues={fieldValues}>
<div className={['module_content_wrapper', styles.people_cards].join(' ')}>
<pre style={{ lineHeight: '20px' }}>Field values:{JSON.stringify(fieldValues, null, 1)}</pre>
{people_cards.map((card, index) => {
let { old_title, new_title } = card
return (
<div key={index} className={styles.card}>
<div className={styles.text_wrapper}>
<p>Old title:{old_title}</p>
<p>New Title:{new_title}</p>
</div>
</div>
)
})}
</div>
</ModuleWrapper>
)
}
export const fields = (
<ModuleFields>
<FieldGroup label="Styles" name="styles" tab="STYLE">
<ModuleWrapperStyleFields />
</FieldGroup>
<RepeatedFieldGroup label="Cards" name="people_cards" occurrence={{ min: 0, default: 3 }}>
<TextField name="old_title" label="Title" default="title" />
<TextField name="new_title" label="Title" default="title" propertyAliasesPaths={{ new_title: ['old_title'] }} />
</RepeatedFieldGroup>
</ModuleFields>
)
This is the field values display in the editor when running the code above:
Other things i have tried:
-Change the alias path to include the path of the repeated field group. This did not work either:
<RepeatedFieldGroup label="Cards" name="people_cards" occurrence={{ min: 0, default: 3 }}>
<TextField name="old_title" label="Title" default="title" />
<TextField name="new_title" label="Title" default="title" propertyAliasesPaths={{ new_title: ['people_cards.old_title'] }} />
</RepeatedFieldGroup
-Create a alias inside the repeated field group that reference a field outside the field group. This works as expected:
<TextField name="old_title" label="Title" default="title" />
<RepeatedFieldGroup label="Cards" name="people_cards" occurrence={{ min: 0, default: 3 }}>
<TextField name="new_title" label="Title" default="title" propertyAliasesPaths={{ new_title: ['old_title'] }} />
</RepeatedFieldGroup>
Does anyone have any idea what’s going on here? Any help would be much appreciated
