-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Refactor navigation title usage #52807
Conversation
This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit. Thank you! ❤️ |
adeb242
to
ea4afb5
Compare
Size Change: 0 B Total Size: 1.44 MB ℹ️ View Unchanged
|
Flaky tests detected in ea4afb5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5614667837
|
#52758 fixes the response from the fallback-navigation endpoint that did not have title.raw in the response, meaning we had to sometimes rely on title.rendered. This removes the extra 'or' statements that were added as hot fixes. The ones that still rely on title.rendered are due to the value needing to be checked within an object, or somewhere that the title property is not rendered via react.
18ae4d6
to
7ed9723
Compare
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.
Thanks for this tidying up and following through with Code Quality 👏
I've rebased this and also tested it across the places where you've made the fixes. I couldn't find any problems.
As you're in the weeds of this, I'd really appreciate an explanation of how it's possible to use just title
without having to check for the sub fields. Brief overview of raw
vs rendered
would also be great. I used to know it well but I've forgotten it and I'm sure you will have it front of mind 🙇
Given that the PHP got backported to 6.3 RC does this PR also needs be backported or will it work without this fix?
If it needs backporting you will need the label and to ping one of the Core Editor Tech release leads.
I'm not 100% sure, but it looked to me that when interacting with the data object itself, you need to check for the
This is only a code quality refactor and doesn't fix any functionality, so it doesn't need to be backported. The old code will work fine, it just won't hit the unnecessary OR statements that this PR removed. |
What?
#52758 fixes the response from the fallback-navigation endpoint that did not have title.raw in the response, meaning we had to sometimes rely on title.rendered. This removes the extra 'or' statements that were added as hot fixes. The ones that still rely on title.rendered are due to the value needing to be checked within an object, or somewhere that the title property is not rendered via react.
Why?
Code cleanup.
How?
Don't check for both
title.rendered
andtitle
props.Testing Instructions
This is a trickier one to test. We will hopefully catch all the scenarios through manual testing. If some pop-up, which isn't unlikely, we'll need to add test coverage for it.