Skip to content

Commit e46913f

Browse files
authored
fix: Content: SEO Tab - Select Page Parent Dropdown is showing the same route multiple times (#2541)
* it will remove the duplicate, the conditions ensure that the item zuid will be displayed is the correct format * onsearch issue , converting the res.data to the same format of the items
1 parent 5860447 commit e46913f

File tree

1 file changed

+9
-1
lines changed
  • src/apps/content-editor/src/app/views/ItemEdit/Meta/ItemSettings/settings

1 file changed

+9
-1
lines changed

src/apps/content-editor/src/app/views/ItemEdit/Meta/ItemSettings/settings/ItemParent.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ export const ItemParent = connect((state) => {
3939
setParents(
4040
parentOptions(props.currentItemLangID, props.path, {
4141
...items,
42-
...res?.data,
42+
// needs to reduce and converts this data as the same format of the items to
43+
// prevent having an issue on having an itemZUID with an incorrect format
44+
// the reason is that the item has a format of {[itemZUID]:data}
45+
// while the res.data has a value of an array which cause the needs of converting
46+
// the response to an object with a zuid as a key
47+
...res?.data.reduce((acc, curr) => {
48+
return { ...acc, [curr.meta.ZUID]: curr };
49+
}, {}),
4350
})
4451
);
4552
});
@@ -107,6 +114,7 @@ export const ItemParent = connect((state) => {
107114
* or a performance issue. To work around this we maintain the `parents` state internal and add the new parent we load from the
108115
* API to allow it to be pre-selected while avoiding re-renders on changes to this item.
109116
*/
117+
110118
setParents(
111119
parentOptions(props.currentItemLangID, props.path, {
112120
...items,

0 commit comments

Comments
 (0)