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 image search functions to use Get and TryGet terminology #20283
Conversation
5f9a214
to
e646953
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.
This seems weird. Why are we searching for non-existing images in the first place?
Because we want UI to support all state images without having a ton of redundant yaml |
Because we want to avoid declaring chrome images for every state of an UI element (disabled, focused, pressed, hover) when we don't need them and fall back to the base image 🤷 The current plumbing seems not great at that and this PR is trying to work -around that but I feel like a bool flag is not the right call here. |
I think bool flag is the only decent way to avoid code duplication. But perhaps we should move |
58ba824
to
f23dd28
Compare
That sounds like the code should not be asking for every state then, doesn't it? 🤔 |
it's not, see |
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.
The flag makes sense to me, the goal of the lookups is to use a specific image if one is defined, but otherwise use the base image.
In this scenario if the specific image isn't defined we're expecting the base image to be used. So logging a message if the specific image is missing isn't helpful.
rebased |
IMO exposing |
We allow the program to function even if we didn't find the image, this is just for logging. If anything using TryGet would make it more confusing. However I'm not saying that the current way the system functions is correct / desired |
The problem with
Where the error the |
separating into 2 methods requires duplication of code, or for us to keep the parameter which would defeat the purpose of having another function |
But I could behind renaming |
Actually going through all the usecases of GetImage I see that we could just remove logging and crash instead. The code crashes regardless further on as null checks don't exist |
I've refactored it to use the |
rebased |
|
|
My bad. After a long investigation into panel rendering code I've found out that |
fixes