Canonical visualization layer fix for missing data layer #12519
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The linked issue contains the steps to reproduce.
Changes might impact everything related to layer sorting (needed on visualization creation and layer addition, among others) and table dependency registration (the logic that shows the modal when you try do delete a dataset with a visualization, warning about related maps).
The problem appeared with a user that has Google Maps as default basemap. That basemap doesn't have labels on top. There's an iteration through layers that reloads the map layers in order to be sure that the map contains the actual layers so we can compute the order. As a side effect, that reloading keeps
map.layers
up-to-date for a next saving. As a map without layers on top doesn't have a layer after the data layer, the data layer addition wasn't refreshed and wasn't saved. The fix refreshes map just after layer addition, keeping it up-to-date as early as possible.