-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Content: SEO Tab - Select Page Parent Dropdown is showing the same route multiple times #2541
Conversation
…d will be displayed is the correct format
@@ -218,7 +218,8 @@ function parentOptions(currentItemLangID, path, items) { | |||
itemData?.web?.path && // must have a path | |||
itemData?.web.path !== "/" && // Exclude homepage | |||
itemData?.web.path !== path && // Exclude current item | |||
itemData?.meta?.langID === currentItemLangID // display only relevant language options | |||
itemData?.meta?.langID === currentItemLangID && // display only relevant language options | |||
itemZUID === itemData?.meta?.ZUID // must be equal to ensure the itemZUID is correct zuid format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is obscure.
What are we comparing here when this equals false?
Are we fundamentally trying to check if meta.ZUID property exists?
If so this logic can be more clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When checking the value of itemZuid the values were not in correct format. When the condition equals to false i remove it in the lists cause it cause duplicates and issues when saving. But I dont have any idea yet why there are itemZUID that are incorrect format in the parentOptions list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting how are they malformed? Can you give an example of a malformed ZUID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agalin920
If I removed my condition, Interestingly when initially loaded it doesnt have duplicate with 1 label, while on searching it increases to more than 783 that has label 2...
And you can see here that there are malformed duplicates on every path that were causing issues...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glespinosa How do those malformed duplicates get created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shrunyan @agalin920
The cause of malforming is in the onSearch in setting parents
While the res.data (response) has an array value (these are the data we get from the api while on searching)
The items that we get from 'const items = useSelector((state) => state.content);'
is an object with a format of
{
[zuid] : data
}
with that inconsistent format , the parentOptions function is confuse that's why there are malform zuid like "1","2" cause it's using the key of an array from the original response.data
@glespinosa while this solves the immediate issue in my mind there is a larger question. Why is there an entry in this list which contains a value that does not match the items zuid. Is that expected? @theofficialnar is this something you think warrants further investigation? |
|
This will remove the duplicate of items and when selected and saved it won't have errors
Closes #2504
Reference image that causing the duplicate

screencast-8-aaeffee09b-7w6v22.manager.dev.zesty.io_8080-2024.02.07-15_34_35.webm