-
Notifications
You must be signed in to change notification settings - Fork 2.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
Fix image expression #9668
Fix image expression #9668
Conversation
It's not clear to me why this existing render test would not have caught these bugs. The setup to for the test seems to be exactly what caused these issues but that test never failed. |
One more reason to eliminate things like
Not sure but one guess would be that Node web workers mock is too fast to process messages ( |
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.
Looks good to me apart from the Flow errors. It would be great to get to the bottom of why the existing test passes though, to avoid similar regressions in the future.
EDIT: Actually, facebook/flow#2289 suggests that Flow should have caught this. It appears to me that Flow is somehow losing the context for |
My best guess on why the existing render test didn't fail is that Node was able to load and parse the local sprite sheet fast enough to cover up this bug. In production, it takes longer to load a sprite sheet over the network and parse potentially hundreds of sprites. A browser test could help with this but I'm not sure how we could make use of Selenium to determine if the correct image has been loaded. |
Launch Checklist
This PR addresses two separate issues with the
image
expression operator.The changes in
src/style
address Inconsistent behaviours of “coalesce” with “image” #9630. Introducewithin
expression #9352 introduced an optional parameter in front ofavailableImages
in the arguments list which accidentally brokeLayout
andTransitioning
expression evaluation. This PR addresses that by adding the optional argument for those expression evaluation pathways.Fixing ⬆️led us to discover a separate issue in which
image
expressions on layers embedded directly into a style (rather than added at runtime) were being evaluated beforeavailableImages
was populated in the source's workers. The @mapbox/map-design-team reported the same issue in https://github.com/mapbox/mapbox-core-style-components/issues/917 although it wasn't clear at first that these two issues revealed the same bug.include before/after visuals or gifs if this PR includes visual changes
Before https://github.com/mapbox/mapbox-core-style-components/issues/917:


After:
Before #9630:


Note: The "not_existing" text label is a fallback to demonstrate the absence of the icon
After:
@mapbox/map-design-team
@mapbox/static-apis
if this PR includes style spec API or visual changes@mapbox/gl-native
if this PR includes shader changes or needs a native portmapbox-gl-js
changelog:<changelog>Fix 'image' expression evaluation which was broken under certain conditions</changelog>