-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Maps] fix layer sorting issue with hidden layers at map load #76007
Conversation
Pinging @elastic/kibana-gis (Team:Geo) |
@elasticmachine merge upstream |
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.
thx for fix!
@@ -128,7 +128,8 @@ export function syncLayerOrder(mbMap: MbMap, spatialFiltersLayer: ILayer, layerL | |||
if (!isLayerInOrder(mbMap, mapLayer, LAYER_CLASS.LABEL, beneathMbLayerId)) { | |||
moveMapLayer(mbMap, mbLayers, mapLayer, LAYER_CLASS.LABEL, beneathMbLayerId); | |||
} | |||
beneathMbLayerId = getBottomMbLayerId(mbLayers, mapLayer, LAYER_CLASS.LABEL); | |||
const bottomMbLayerId = getBottomMbLayerId(mbLayers, mapLayer, LAYER_CLASS.LABEL); | |||
if (bottomMbLayerId) beneathMbLayerId = bottomMbLayerId; |
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 is really subtle. Do you mind adding a comment?
e.g.
When the corresponding bottom mb-layer cannot be found, - e.g. when the kibana-layer is invisible and has not synced with mapbox - retain the previous "beneath"-layer
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.
I commented the unit test to capture the subtleness of the edge case. Do you think more commenting is needed?
Tested locally, works fine, thanks for the quick fix! 🎉 |
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
…or a layer (elastic#76007) Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…or a layer (elastic#76007) Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
fixes #75997
#69444 introduced a regression where hidden layers on map load could cause the sorting to place layers above the hidden layer beneath other layers. This occurred because
beneathMbLayerId
would be set to undefined when there were no mapbox layers for a layer. This PR resolves the issue by only advancingbeneathMbLayerId
if a mapbox layer could be found for the layer.