Skip to content
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

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

glespinosa
Copy link
Contributor

@glespinosa glespinosa commented Feb 7, 2024

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
image

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

@zcolah zcolah added the vqa VQA is complete and approved label Feb 8, 2024
@@ -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
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

@glespinosa glespinosa Feb 13, 2024

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...

image

And you can see here that there are malformed duplicates on every path that were causing issues...
image

Copy link
Contributor

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?

Copy link
Contributor Author

@glespinosa glespinosa Feb 21, 2024

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)
image

The items that we get from 'const items = useSelector((state) => state.content);'
is an object with a format of
{
[zuid] : data
}
image

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

@shrunyan
Copy link
Contributor

shrunyan commented Feb 8, 2024

@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?

@glespinosa
Copy link
Contributor Author

@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?

#2541 (comment)

@glespinosa glespinosa added the ready PR is complete and ready for deployment label Feb 22, 2024
@shrunyan shrunyan merged commit e46913f into master Feb 28, 2024
1 check failed
@shrunyan shrunyan deleted the fix/duplicate-parent-item branch February 28, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR is complete and ready for deployment vqa VQA is complete and approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content: SEO Tab - Select Page Parent Dropdown is showing the same route multiple times
5 participants