[Maps] Show labels after saving edits while staying on Vector tiles (…#240728
[Maps] Show labels after saving edits while staying on Vector tiles (…#240728nreese merged 7 commits intoelastic:mainfrom
Conversation
…MVT)
When a Maps layer uses "Use vector tiles" scaling, labels now appear after
the user saves edits or modifies label styling, without requiring the user
to toggle scaling away from Vector tiles.
## Problem
Users adding label styling (Fixed value or By value) to ES Search layers
with "Use vector tiles" scaling would not see labels appear until they
manually toggled the scaling setting away from Vector tiles and back.
## Root Cause
Three interconnected issues prevented labels from appearing:
1. **Label change detection failure**: The style change handler checked for
MVT_VECTOR layer type, but ES Search layers using "Use vector tiles" are
GEOJSON_VECTOR type with scalingType=MVT property. This meant label
changes were never detected for the most common use case.
2. **Missing force refresh support**: The MVT tile sync logic only checked
forceRefreshDueToDrawing but ignored isForceRefresh flag used for style
changes. Even when label changes were detected elsewhere, tiles wouldn't
refresh.
3. **Wrong rendering path**: GEOJSON_VECTOR layers with scalingType=MVT were
using GeoJSON rendering (fetching features as GeoJSON) instead of MVT
rendering (requesting vector tiles). This meant the layer never requested
tiles with with_labels=true, so Elasticsearch never generated label points.
## Solution
**1. Detect label changes for MVT-scaled layers (layer_actions.ts)**
- Check sourceDescriptor.scalingType === SCALING_TYPES.MVT instead of
layer type
- Compare previous/next label configurations using JSON.stringify
- Dispatch syncDataForLayerId with isForceRefresh=true when labels change
- Works for both GEOJSON_VECTOR and MVT_VECTOR layer types
**2. Respect force refresh flag (mvt_source_data.ts)**
- Added !syncContext.isForceRefresh to canSkip condition
- Optimized refresh token generation: only create new token when hasLabels
or buffer actually change (prevents infinite refresh loops)
- Ensures tiles are re-fetched when label styling changes
**3. Make GeoJsonVectorLayer MVT-aware (geojson_vector_layer.tsx)**
- _isTiled(): Returns true when source.isMvt() is true (enables vector
tile rendering)
- syncLayerWithMB(): Uses MapLibre vector tile source instead of GeoJSON
source when using MVT scaling
- _syncData(): Calls syncMvtSourceData() with hasLabels parameter for MVT
scaling, ensuring tiles are requested with with_labels=true
- getLayerIcon(), getBounds(), getFeatureById(),
getStyleMetaDescriptorFromLocalFeatures(): Handle MVT mode gracefully to
prevent crashes from accessing non-existent feature collection
- _requiresPrevSourceCleanup(): Detect when MVT tile URL changes for
proper layer re-rendering
## Testing
Tested with ES Search source using "Use vector tiles" scaling:
- ✅ Add Fixed value label styling → Labels appear immediately
- ✅ Add By value label styling → Labels appear immediately
- ✅ Toggle labels on/off → Tiles refresh correctly with/without labels
- ✅ Change label text while typing → Updates in real-time
- ✅ No crashes when creating layers
- ✅ No infinite refresh loops or flickering
- ✅ Layer icons and bounds work correctly
- ✅ Performance: tiles refresh only when hasLabels or buffer actually change
## Files Changed
- x-pack/platform/plugins/shared/maps/public/actions/layer_actions.ts
- x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx
- x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts
| const sourceDataRequest = this.getSourceDataRequest(); | ||
| if (sourceDataRequest) { | ||
| const sourceData = sourceDataRequest.getData() as any; | ||
| if (sourceData && sourceData.tileUrl) { |
There was a problem hiding this comment.
Vector tile layers are rendered with x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx. GeoJsonVectorLayer should not be adding vector source to the map.
There was a problem hiding this comment.
Thanks for the review! I’ve reverted GeoJsonVectorLayer back to its GeoJSON-only behavior so it no longer adds a vector source, and I've updated the description of this PR.
The fix now lives entirely in the MVT path:
• layer_actions.ts detects label style changes on MVT-scaled layers and triggers a forced sync.
• mvt_source_data.ts respects isForceRefresh and requests tiles with with_labels=true when labels are active (per the _mvt API).
• new_vector_layer_wizard/wizard.tsx emits an MvtVectorLayer descriptor when Create index uses MVT scaling so new layers start on the MVT pipeline.
After these changes, labels appear on vector tiles after styling/save without requiring a scaling toggle. Happy to adjust further if needed/wanted.
trigger a forced sync when label styling toggles on MVT-scaled layers include label/buffer state in MVT tile refresh tokens and request with_labels=true instantiate MvtVectorLayer descriptors from the Create index wizard when scaling stays MVT
| // syncDataForLayer may not trigger endDataLoad if no re-fetch is required | ||
| dispatch(updateStyleMeta(layerId)); | ||
|
|
||
| // Check if label styling changed for layers using MVT scaling - this requires tile refresh |
There was a problem hiding this comment.
Redux actions are generic and should not leak layer implemenation details. This implemenation leaks MVT implemenation details. Instead, this logic should get pushed into MvtVectorLayer.syncData so that updated style change re-fetches data.
There was a problem hiding this comment.
Thanks! I dropped the MVT-specific refresh logic from layer_actions.ts—it’s back to the generic implementation. MvtVectorLayer.syncData now snapshots the label descriptor and hasLabels flag into the request meta so any label-style change forces a tile refetch through the layer itself. Will update the description of the pR.
- track the current label descriptor/hasLabels in MvtVectorLayer.syncData so tile cache invalidates on label changes - continue honoring hasLabels/buffer in syncMvtSourceData, requesting tiles with with_labels=true only when needed - make the Create index wizard instantiate MvtVectorLayer descriptors when scaling is MVT, so the refresh logic always applies Testing: manual (Create index → draw feature → toggle labels)
82a5e9f to
7aab6ee
Compare
nreese
left a comment
There was a problem hiding this comment.
The issue is isolated to x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx. Once the wizard creates the correct layer, then issue is resolved. Please revert changes to mvt_source_data and mvt_vector_layer as they are not needed.
| { sourceDescriptor }, | ||
| this.props.mapColors | ||
| ); | ||
| const layerDescriptor = |
There was a problem hiding this comment.
Thanks for pointing this out. This is a mistake to create a GeoJson layer when source scaling is MVT.
Can you call createDefaultLayerDescriptor to create the layer descriptor? Thanks.
- reuse createDefaultLayerDescriptor so MVT scaling yields an MvtVectorLayer - drop the earlier MVT layer/source tweaks that aren’t needed once the wizard creates the correct layer
| }); | ||
| const layerDescriptor = GeoJsonVectorLayer.createDescriptor( | ||
| { sourceDescriptor }, | ||
| const layerDescriptor = createDefaultLayerDescriptor( |
There was a problem hiding this comment.
createDefaultLayerDescriptor calls ESSearchSource.createDescriptor so this can just be
const layerDescriptor = createDefaultLayerDescriptor(
{
indexPatternId,
geoField: 'coordinates',
filterByMapBounds: false,
applyGlobalQuery: false,
},
this.props.mapColors
);
…h the raw descriptor fields (no intermediate ESSearchSource.createDescriptor)
nreese
left a comment
There was a problem hiding this comment.
changes LGTM - thanks for contributing to kibana
|
@elasticmachine merge upstream |
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
|
/ci |
|
/ci |
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
|
@elasticmachine run docs-build |
|
Starting backport for target branches: 8.19, 9.1, 9.2 |
elastic#240728) Closes elastic#240727 --- ## Summary When using **Maps → Create index (Draw shapes)**, the new layer defaults to **Scaling → Use vector tiles**. Adding label styling (Fixed or By value) previously did **not** display labels until the user manually changed Scaling to **Limit results** and back. This PR makes labels appear immediately (after styling or save) on vector-tiles layers by: - Requesting MVT tiles with **`with_labels=true`** when label styling is active - **Refreshing** tile sources when label styling changes and after saving edits - Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT` through the MVT pipeline Elastic’s `_mvt` API returns suggested label points when `with_labels=true`; this wires Kibana to use that path and refresh tiles accordingly. Kibana’s **Vector layer** docs describe the scaling modes this aligns with. > 🧠 Investigation and solution developed with the help of the large language model **Claude Sonnet 4.5**, used to analyze the root cause and assist in implementation. --- ### What changed (files) 1. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`** • Snapshots the current label descriptor and `hasLabels` flag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer. 2. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`** • Respect `isForceRefresh` (was checking only `forceRefreshDueToDrawing`). • Generate a new token only when `hasLabels` or buffer change (prevents loops). • Include **`with_labels=true`** in tile requests when label styling is active (Elasticsearch `_mvt` label points). 3. **`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`** • When Create index uses MVT scaling, emit an **MvtVectorLayer** descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic. > **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no MVT source added by GeoJSON). Vector-tile rendering remains owned by `MvtVectorLayer`. Per Elastic’s docs, the vector-tile search API can return suggested label points when `with_labels=true`; the Vector layer docs describe when to use **Use vector tiles** vs **Limit results**. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle. --- ### Why During the Create index workflow, vector-tiles scaling is the default. Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed. By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle. --- ### Before / After | Before | After | |:--|:--| | Create index → Draw point → Add label → Label missing until Scaling changed | Create index → Draw point → Add label → Label appears instantly (no toggle needed) | **Before (GIF):**  **After (GIF):**  --- ### Testing This change was verified manually; **no new unit or functional tests were added** in this PR. **Manual validation steps** - Add layer → Create index - Draw a point or other shape - Add label styling (Fixed value and By value) → labels appear immediately without toggling scaling - Modify label text → label updates in real time - Toggle labels on/off → tiles refresh correctly - Save edits → labels persist after saving - No crashes, flickering, or infinite refresh loops **Test coverage note** Existing Jest tests for Maps layers and source syncing still pass. Potential follow-ups: - Label style change triggers `isForceRefresh=true` - `with_labels=true` included in MVT tile requests when labels are active - GeoJSON→MVT rendering path switching works without regression --- ## Release note **Fix:** Labels in the **Create index** flow now render with the default **Use vector tiles** scaling as soon as label styling is applied (or after save), without requiring a scaling toggle. --- ### Checklist - [x] No new UI strings (i18n N/A); follows EUI sentence case - [x] No HTTP API or security changes - [ ] Unit tests updated/added *(none in this PR; validated manually)* - [x] Include release note - [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`) will be applied by maintainers during triage --- ### Identify risks - **Scope:** Limited to Create index / MVT-scaling render path - **Performance:** `with_labels` adds small label points per tile; only used when labels are enabled - **Mitigation:** Refresh is scoped to the affected layer; token generation avoids loops --- ### Validation ```bash nvm use 22.17.1 yarn kbn bootstrap yarn lint yarn test:jest x-pack/platform/plugins/shared/maps yarn es snapshot --license trial yarn start --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 3b3adac)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…iles (… (#240728) (#241219) # Backport This will backport the following commits from `main` to `9.2`: - [[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)](#240728) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jakob Malmo","email":"jakobmalmo@protonmail.com"},"sourceCommit":{"committedDate":"2025-10-30T03:10:46Z","message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","💝community","Feature:Maps","backport:version","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[Maps] Show labels after saving edits while staying on Vector tiles (…","number":240728,"url":"https://github.com/elastic/kibana/pull/240728","mergeCommit":{"message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240728","number":240728,"mergeCommit":{"message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jakob Malmo <jakobmalmo@protonmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elastic#240728) Closes elastic#240727 --- ## Summary When using **Maps → Create index (Draw shapes)**, the new layer defaults to **Scaling → Use vector tiles**. Adding label styling (Fixed or By value) previously did **not** display labels until the user manually changed Scaling to **Limit results** and back. This PR makes labels appear immediately (after styling or save) on vector-tiles layers by: - Requesting MVT tiles with **`with_labels=true`** when label styling is active - **Refreshing** tile sources when label styling changes and after saving edits - Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT` through the MVT pipeline Elastic’s `_mvt` API returns suggested label points when `with_labels=true`; this wires Kibana to use that path and refresh tiles accordingly. Kibana’s **Vector layer** docs describe the scaling modes this aligns with. > 🧠 Investigation and solution developed with the help of the large language model **Claude Sonnet 4.5**, used to analyze the root cause and assist in implementation. --- ### What changed (files) 1. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`** • Snapshots the current label descriptor and `hasLabels` flag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer. 2. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`** • Respect `isForceRefresh` (was checking only `forceRefreshDueToDrawing`). • Generate a new token only when `hasLabels` or buffer change (prevents loops). • Include **`with_labels=true`** in tile requests when label styling is active (Elasticsearch `_mvt` label points). 3. **`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`** • When Create index uses MVT scaling, emit an **MvtVectorLayer** descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic. > **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no MVT source added by GeoJSON). Vector-tile rendering remains owned by `MvtVectorLayer`. Per Elastic’s docs, the vector-tile search API can return suggested label points when `with_labels=true`; the Vector layer docs describe when to use **Use vector tiles** vs **Limit results**. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle. --- ### Why During the Create index workflow, vector-tiles scaling is the default. Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed. By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle. --- ### Before / After | Before | After | |:--|:--| | Create index → Draw point → Add label → Label missing until Scaling changed | Create index → Draw point → Add label → Label appears instantly (no toggle needed) | **Before (GIF):**  **After (GIF):**  --- ### Testing This change was verified manually; **no new unit or functional tests were added** in this PR. **Manual validation steps** - Add layer → Create index - Draw a point or other shape - Add label styling (Fixed value and By value) → labels appear immediately without toggling scaling - Modify label text → label updates in real time - Toggle labels on/off → tiles refresh correctly - Save edits → labels persist after saving - No crashes, flickering, or infinite refresh loops **Test coverage note** Existing Jest tests for Maps layers and source syncing still pass. Potential follow-ups: - Label style change triggers `isForceRefresh=true` - `with_labels=true` included in MVT tile requests when labels are active - GeoJSON→MVT rendering path switching works without regression --- ## Release note **Fix:** Labels in the **Create index** flow now render with the default **Use vector tiles** scaling as soon as label styling is applied (or after save), without requiring a scaling toggle. --- ### Checklist - [x] No new UI strings (i18n N/A); follows EUI sentence case - [x] No HTTP API or security changes - [ ] Unit tests updated/added *(none in this PR; validated manually)* - [x] Include release note - [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`) will be applied by maintainers during triage --- ### Identify risks - **Scope:** Limited to Create index / MVT-scaling render path - **Performance:** `with_labels` adds small label points per tile; only used when labels are enabled - **Mitigation:** Refresh is scoped to the affected layer; token generation avoids loops --- ### Validation ```bash nvm use 22.17.1 yarn kbn bootstrap yarn lint yarn test:jest x-pack/platform/plugins/shared/maps yarn es snapshot --license trial yarn start --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
elastic#240728) Closes elastic#240727 --- ## Summary When using **Maps → Create index (Draw shapes)**, the new layer defaults to **Scaling → Use vector tiles**. Adding label styling (Fixed or By value) previously did **not** display labels until the user manually changed Scaling to **Limit results** and back. This PR makes labels appear immediately (after styling or save) on vector-tiles layers by: - Requesting MVT tiles with **`with_labels=true`** when label styling is active - **Refreshing** tile sources when label styling changes and after saving edits - Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT` through the MVT pipeline Elastic’s `_mvt` API returns suggested label points when `with_labels=true`; this wires Kibana to use that path and refresh tiles accordingly. Kibana’s **Vector layer** docs describe the scaling modes this aligns with. > 🧠 Investigation and solution developed with the help of the large language model **Claude Sonnet 4.5**, used to analyze the root cause and assist in implementation. --- ### What changed (files) 1. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`** • Snapshots the current label descriptor and `hasLabels` flag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer. 2. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`** • Respect `isForceRefresh` (was checking only `forceRefreshDueToDrawing`). • Generate a new token only when `hasLabels` or buffer change (prevents loops). • Include **`with_labels=true`** in tile requests when label styling is active (Elasticsearch `_mvt` label points). 3. **`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`** • When Create index uses MVT scaling, emit an **MvtVectorLayer** descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic. > **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no MVT source added by GeoJSON). Vector-tile rendering remains owned by `MvtVectorLayer`. Per Elastic’s docs, the vector-tile search API can return suggested label points when `with_labels=true`; the Vector layer docs describe when to use **Use vector tiles** vs **Limit results**. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle. --- ### Why During the Create index workflow, vector-tiles scaling is the default. Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed. By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle. --- ### Before / After | Before | After | |:--|:--| | Create index → Draw point → Add label → Label missing until Scaling changed | Create index → Draw point → Add label → Label appears instantly (no toggle needed) | **Before (GIF):**  **After (GIF):**  --- ### Testing This change was verified manually; **no new unit or functional tests were added** in this PR. **Manual validation steps** - Add layer → Create index - Draw a point or other shape - Add label styling (Fixed value and By value) → labels appear immediately without toggling scaling - Modify label text → label updates in real time - Toggle labels on/off → tiles refresh correctly - Save edits → labels persist after saving - No crashes, flickering, or infinite refresh loops **Test coverage note** Existing Jest tests for Maps layers and source syncing still pass. Potential follow-ups: - Label style change triggers `isForceRefresh=true` - `with_labels=true` included in MVT tile requests when labels are active - GeoJSON→MVT rendering path switching works without regression --- ## Release note **Fix:** Labels in the **Create index** flow now render with the default **Use vector tiles** scaling as soon as label styling is applied (or after save), without requiring a scaling toggle. --- ### Checklist - [x] No new UI strings (i18n N/A); follows EUI sentence case - [x] No HTTP API or security changes - [ ] Unit tests updated/added *(none in this PR; validated manually)* - [x] Include release note - [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`) will be applied by maintainers during triage --- ### Identify risks - **Scope:** Limited to Create index / MVT-scaling render path - **Performance:** `with_labels` adds small label points per tile; only used when labels are enabled - **Mitigation:** Refresh is scoped to the affected layer; token generation avoids loops --- ### Validation ```bash nvm use 22.17.1 yarn kbn bootstrap yarn lint yarn test:jest x-pack/platform/plugins/shared/maps yarn es snapshot --license trial yarn start --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 3b3adac) # Conflicts: # x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
elastic#240728) Closes elastic#240727 --- ## Summary When using **Maps → Create index (Draw shapes)**, the new layer defaults to **Scaling → Use vector tiles**. Adding label styling (Fixed or By value) previously did **not** display labels until the user manually changed Scaling to **Limit results** and back. This PR makes labels appear immediately (after styling or save) on vector-tiles layers by: - Requesting MVT tiles with **`with_labels=true`** when label styling is active - **Refreshing** tile sources when label styling changes and after saving edits - Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT` through the MVT pipeline Elastic’s `_mvt` API returns suggested label points when `with_labels=true`; this wires Kibana to use that path and refresh tiles accordingly. Kibana’s **Vector layer** docs describe the scaling modes this aligns with. > 🧠 Investigation and solution developed with the help of the large language model **Claude Sonnet 4.5**, used to analyze the root cause and assist in implementation. --- ### What changed (files) 1. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`** • Snapshots the current label descriptor and `hasLabels` flag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer. 2. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`** • Respect `isForceRefresh` (was checking only `forceRefreshDueToDrawing`). • Generate a new token only when `hasLabels` or buffer change (prevents loops). • Include **`with_labels=true`** in tile requests when label styling is active (Elasticsearch `_mvt` label points). 3. **`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`** • When Create index uses MVT scaling, emit an **MvtVectorLayer** descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic. > **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no MVT source added by GeoJSON). Vector-tile rendering remains owned by `MvtVectorLayer`. Per Elastic’s docs, the vector-tile search API can return suggested label points when `with_labels=true`; the Vector layer docs describe when to use **Use vector tiles** vs **Limit results**. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle. --- ### Why During the Create index workflow, vector-tiles scaling is the default. Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed. By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle. --- ### Before / After | Before | After | |:--|:--| | Create index → Draw point → Add label → Label missing until Scaling changed | Create index → Draw point → Add label → Label appears instantly (no toggle needed) | **Before (GIF):**  **After (GIF):**  --- ### Testing This change was verified manually; **no new unit or functional tests were added** in this PR. **Manual validation steps** - Add layer → Create index - Draw a point or other shape - Add label styling (Fixed value and By value) → labels appear immediately without toggling scaling - Modify label text → label updates in real time - Toggle labels on/off → tiles refresh correctly - Save edits → labels persist after saving - No crashes, flickering, or infinite refresh loops **Test coverage note** Existing Jest tests for Maps layers and source syncing still pass. Potential follow-ups: - Label style change triggers `isForceRefresh=true` - `with_labels=true` included in MVT tile requests when labels are active - GeoJSON→MVT rendering path switching works without regression --- ## Release note **Fix:** Labels in the **Create index** flow now render with the default **Use vector tiles** scaling as soon as label styling is applied (or after save), without requiring a scaling toggle. --- ### Checklist - [x] No new UI strings (i18n N/A); follows EUI sentence case - [x] No HTTP API or security changes - [ ] Unit tests updated/added *(none in this PR; validated manually)* - [x] Include release note - [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`) will be applied by maintainers during triage --- ### Identify risks - **Scope:** Limited to Create index / MVT-scaling render path - **Performance:** `with_labels` adds small label points per tile; only used when labels are enabled - **Mitigation:** Refresh is scoped to the affected layer; token generation avoids loops --- ### Validation ```bash nvm use 22.17.1 yarn kbn bootstrap yarn lint yarn test:jest x-pack/platform/plugins/shared/maps yarn es snapshot --license trial yarn start --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 3b3adac) # Conflicts: # x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx
…iles (… (#240728) (#241283) # Backport This will backport the following commits from `main` to `9.1`: - [[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)](#240728) <!--- Backport version: 10.1.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jakob Malmo","email":"jakobmalmo@protonmail.com"},"sourceCommit":{"committedDate":"2025-10-30T03:10:46Z","message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","💝community","Feature:Maps","backport:version","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[Maps] Show labels after saving edits while staying on Vector tiles (…","number":240728,"url":"https://github.com/elastic/kibana/pull/240728","mergeCommit":{"message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240728","number":240728,"mergeCommit":{"message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/241219","number":241219,"state":"MERGED","mergeCommit":{"sha":"7e6660eee2c149744580221d02a1a4987f5ea51c","message":"[9.2] [Maps] Show labels after saving edits while staying on Vector tiles (… (#240728) (#241219)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.2`:\n- [[Maps] Show labels after saving edits while staying on Vector tiles\n(… (#240728)](https://github.com/elastic/kibana/pull/240728)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Jakob Malmo <jakobmalmo@protonmail.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>"}}]}] BACKPORT--> Co-authored-by: Jakob Malmo <jakobmalmo@protonmail.com>
…tiles (… (#240728) (#241285) # Backport This will backport the following commits from `main` to `8.19`: - [[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)](#240728) <!--- Backport version: 10.1.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jakob Malmo","email":"jakobmalmo@protonmail.com"},"sourceCommit":{"committedDate":"2025-10-30T03:10:46Z","message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","💝community","Feature:Maps","backport:version","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[Maps] Show labels after saving edits while staying on Vector tiles (…","number":240728,"url":"https://github.com/elastic/kibana/pull/240728","mergeCommit":{"message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240728","number":240728,"mergeCommit":{"message":"[Maps] Show labels after saving edits while staying on Vector tiles (… (#240728)\n\nCloses #240727 \n---\n\n## Summary\nWhen using **Maps → Create index (Draw shapes)**, the new layer defaults\nto **Scaling → Use vector tiles**.\nAdding label styling (Fixed or By value) previously did **not** display\nlabels until the user manually changed Scaling to **Limit results** and\nback.\nThis PR makes labels appear immediately (after styling or save) on\nvector-tiles layers by:\n\n- Requesting MVT tiles with **`with_labels=true`** when label styling is\nactive\n- **Refreshing** tile sources when label styling changes and after\nsaving edits\n- Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT`\nthrough the MVT pipeline\n\nElastic’s `_mvt` API returns suggested label points when\n`with_labels=true`; this wires Kibana to use that path and refresh tiles\naccordingly.\nKibana’s **Vector layer** docs describe the scaling modes this aligns\nwith.\n\n> 🧠 Investigation and solution developed with the help of the large\nlanguage model **Claude Sonnet 4.5**, used to analyze the root cause and\nassist in implementation.\n\n---\n\n### What changed (files)\n1.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`**\n• Snapshots the current label descriptor and `hasLabels` flag into the\nsource request meta; any change invalidates the cached tiles and\nre-fetches through the MVT layer.\n\n2.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`**\n• Respect `isForceRefresh` (was checking only\n`forceRefreshDueToDrawing`).\n• Generate a new token only when `hasLabels` or buffer change (prevents\nloops).\n• Include **`with_labels=true`** in tile requests when label styling is\nactive (Elasticsearch `_mvt` label points).\n\n3.\n**`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`**\n• When Create index uses MVT scaling, emit an **MvtVectorLayer**\ndescriptor so the layer starts on the MVT pipeline and picks up the\nlabel-refresh logic.\n\n> **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no\nMVT source added by GeoJSON). Vector-tile rendering remains owned by\n`MvtVectorLayer`.\n\nPer Elastic’s docs, the vector-tile search API can return suggested\nlabel points when `with_labels=true`; the Vector layer docs describe\nwhen to use **Use vector tiles** vs **Limit results**. This change wires\nKibana’s MVT path to request tiles with labels and refresh them when\nstyling/saving, so labels render without a scaling toggle.\n\n\n\n---\n\n### Why\nDuring the Create index workflow, vector-tiles scaling is the default. \nTiles are built server-side from indexed data, so unsaved edits and\nlabel changes don’t show until tiles are refreshed.\nBy requesting tiles with labels and refreshing them on style or save,\nlabels now render as expected without a manual scaling toggle.\n\n---\n\n### Before / After\n| Before | After |\n|:--|:--|\n| Create index → Draw point → Add label → Label missing until Scaling\nchanged | Create index → Draw point → Add label → Label appears\ninstantly (no toggle needed) |\n\n**Before (GIF):** \n\n\n\n**After (GIF):** \n\n\n\n---\n\n### Testing\nThis change was verified manually; **no new unit or functional tests\nwere added** in this PR.\n\n**Manual validation steps**\n- Add layer → Create index\n- Draw a point or other shape\n- Add label styling (Fixed value and By value) → labels appear\nimmediately without toggling scaling\n- Modify label text → label updates in real time\n- Toggle labels on/off → tiles refresh correctly\n- Save edits → labels persist after saving\n- No crashes, flickering, or infinite refresh loops\n\n**Test coverage note**\nExisting Jest tests for Maps layers and source syncing still pass. \nPotential follow-ups:\n- Label style change triggers `isForceRefresh=true`\n- `with_labels=true` included in MVT tile requests when labels are\nactive\n- GeoJSON→MVT rendering path switching works without regression\n\n---\n\n## Release note\n**Fix:** Labels in the **Create index** flow now render with the default\n**Use vector tiles** scaling as soon as label styling is applied (or\nafter save), without requiring a scaling toggle.\n\n---\n\n### Checklist\n- [x] No new UI strings (i18n N/A); follows EUI sentence case \n- [x] No HTTP API or security changes \n- [ ] Unit tests updated/added *(none in this PR; validated manually)* \n- [x] Include release note \n- [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`)\nwill be applied by maintainers during triage\n\n---\n\n### Identify risks\n- **Scope:** Limited to Create index / MVT-scaling render path \n- **Performance:** `with_labels` adds small label points per tile; only\nused when labels are enabled\n- **Mitigation:** Refresh is scoped to the affected layer; token\ngeneration avoids loops\n\n---\n\n### Validation\n```bash\nnvm use 22.17.1\nyarn kbn bootstrap\nyarn lint\nyarn test:jest x-pack/platform/plugins/shared/maps\nyarn es snapshot --license trial\nyarn start\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"3b3adac2e24a84f216bec2d0884114013b03854a"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/241219","number":241219,"state":"MERGED","mergeCommit":{"sha":"7e6660eee2c149744580221d02a1a4987f5ea51c","message":"[9.2] [Maps] Show labels after saving edits while staying on Vector tiles (… (#240728) (#241219)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.2`:\n- [[Maps] Show labels after saving edits while staying on Vector tiles\n(… (#240728)](https://github.com/elastic/kibana/pull/240728)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Jakob Malmo <jakobmalmo@protonmail.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>"}}]}] BACKPORT--> Co-authored-by: Jakob Malmo <jakobmalmo@protonmail.com>
elastic#240728) Closes elastic#240727 --- ## Summary When using **Maps → Create index (Draw shapes)**, the new layer defaults to **Scaling → Use vector tiles**. Adding label styling (Fixed or By value) previously did **not** display labels until the user manually changed Scaling to **Limit results** and back. This PR makes labels appear immediately (after styling or save) on vector-tiles layers by: - Requesting MVT tiles with **`with_labels=true`** when label styling is active - **Refreshing** tile sources when label styling changes and after saving edits - Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT` through the MVT pipeline Elastic’s `_mvt` API returns suggested label points when `with_labels=true`; this wires Kibana to use that path and refresh tiles accordingly. Kibana’s **Vector layer** docs describe the scaling modes this aligns with. > 🧠 Investigation and solution developed with the help of the large language model **Claude Sonnet 4.5**, used to analyze the root cause and assist in implementation. --- ### What changed (files) 1. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`** • Snapshots the current label descriptor and `hasLabels` flag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer. 2. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`** • Respect `isForceRefresh` (was checking only `forceRefreshDueToDrawing`). • Generate a new token only when `hasLabels` or buffer change (prevents loops). • Include **`with_labels=true`** in tile requests when label styling is active (Elasticsearch `_mvt` label points). 3. **`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`** • When Create index uses MVT scaling, emit an **MvtVectorLayer** descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic. > **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no MVT source added by GeoJSON). Vector-tile rendering remains owned by `MvtVectorLayer`. Per Elastic’s docs, the vector-tile search API can return suggested label points when `with_labels=true`; the Vector layer docs describe when to use **Use vector tiles** vs **Limit results**. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle. --- ### Why During the Create index workflow, vector-tiles scaling is the default. Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed. By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle. --- ### Before / After | Before | After | |:--|:--| | Create index → Draw point → Add label → Label missing until Scaling changed | Create index → Draw point → Add label → Label appears instantly (no toggle needed) | **Before (GIF):**  **After (GIF):**  --- ### Testing This change was verified manually; **no new unit or functional tests were added** in this PR. **Manual validation steps** - Add layer → Create index - Draw a point or other shape - Add label styling (Fixed value and By value) → labels appear immediately without toggling scaling - Modify label text → label updates in real time - Toggle labels on/off → tiles refresh correctly - Save edits → labels persist after saving - No crashes, flickering, or infinite refresh loops **Test coverage note** Existing Jest tests for Maps layers and source syncing still pass. Potential follow-ups: - Label style change triggers `isForceRefresh=true` - `with_labels=true` included in MVT tile requests when labels are active - GeoJSON→MVT rendering path switching works without regression --- ## Release note **Fix:** Labels in the **Create index** flow now render with the default **Use vector tiles** scaling as soon as label styling is applied (or after save), without requiring a scaling toggle. --- ### Checklist - [x] No new UI strings (i18n N/A); follows EUI sentence case - [x] No HTTP API or security changes - [ ] Unit tests updated/added *(none in this PR; validated manually)* - [x] Include release note - [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`) will be applied by maintainers during triage --- ### Identify risks - **Scope:** Limited to Create index / MVT-scaling render path - **Performance:** `with_labels` adds small label points per tile; only used when labels are enabled - **Mitigation:** Refresh is scoped to the affected layer; token generation avoids loops --- ### Validation ```bash nvm use 22.17.1 yarn kbn bootstrap yarn lint yarn test:jest x-pack/platform/plugins/shared/maps yarn es snapshot --license trial yarn start --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
elastic#240728) Closes elastic#240727 --- ## Summary When using **Maps → Create index (Draw shapes)**, the new layer defaults to **Scaling → Use vector tiles**. Adding label styling (Fixed or By value) previously did **not** display labels until the user manually changed Scaling to **Limit results** and back. This PR makes labels appear immediately (after styling or save) on vector-tiles layers by: - Requesting MVT tiles with **`with_labels=true`** when label styling is active - **Refreshing** tile sources when label styling changes and after saving edits - Properly routing **GEOJSON_VECTOR** layers with `scalingType: MVT` through the MVT pipeline Elastic’s `_mvt` API returns suggested label points when `with_labels=true`; this wires Kibana to use that path and refresh tiles accordingly. Kibana’s **Vector layer** docs describe the scaling modes this aligns with. > 🧠 Investigation and solution developed with the help of the large language model **Claude Sonnet 4.5**, used to analyze the root cause and assist in implementation. --- ### What changed (files) 1. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx`** • Snapshots the current label descriptor and `hasLabels` flag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer. 2. **`x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts`** • Respect `isForceRefresh` (was checking only `forceRefreshDueToDrawing`). • Generate a new token only when `hasLabels` or buffer change (prevents loops). • Include **`with_labels=true`** in tile requests when label styling is active (Elasticsearch `_mvt` label points). 3. **`x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx`** • When Create index uses MVT scaling, emit an **MvtVectorLayer** descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic. > **Note:** `geojson_vector_layer.tsx` is restored to match `main` (no MVT source added by GeoJSON). Vector-tile rendering remains owned by `MvtVectorLayer`. Per Elastic’s docs, the vector-tile search API can return suggested label points when `with_labels=true`; the Vector layer docs describe when to use **Use vector tiles** vs **Limit results**. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle. --- ### Why During the Create index workflow, vector-tiles scaling is the default. Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed. By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle. --- ### Before / After | Before | After | |:--|:--| | Create index → Draw point → Add label → Label missing until Scaling changed | Create index → Draw point → Add label → Label appears instantly (no toggle needed) | **Before (GIF):**  **After (GIF):**  --- ### Testing This change was verified manually; **no new unit or functional tests were added** in this PR. **Manual validation steps** - Add layer → Create index - Draw a point or other shape - Add label styling (Fixed value and By value) → labels appear immediately without toggling scaling - Modify label text → label updates in real time - Toggle labels on/off → tiles refresh correctly - Save edits → labels persist after saving - No crashes, flickering, or infinite refresh loops **Test coverage note** Existing Jest tests for Maps layers and source syncing still pass. Potential follow-ups: - Label style change triggers `isForceRefresh=true` - `with_labels=true` included in MVT tile requests when labels are active - GeoJSON→MVT rendering path switching works without regression --- ## Release note **Fix:** Labels in the **Create index** flow now render with the default **Use vector tiles** scaling as soon as label styling is applied (or after save), without requiring a scaling toggle. --- ### Checklist - [x] No new UI strings (i18n N/A); follows EUI sentence case - [x] No HTTP API or security changes - [ ] Unit tests updated/added *(none in this PR; validated manually)* - [x] Include release note - [ ] Labels (`release_note:*`, `backport:*`, `review`, `community`) will be applied by maintainers during triage --- ### Identify risks - **Scope:** Limited to Create index / MVT-scaling render path - **Performance:** `with_labels` adds small label points per tile; only used when labels are enabled - **Mitigation:** Refresh is scoped to the affected layer; token generation avoids loops --- ### Validation ```bash nvm use 22.17.1 yarn kbn bootstrap yarn lint yarn test:jest x-pack/platform/plugins/shared/maps yarn es snapshot --license trial yarn start --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>

Closes #240727
Summary
When using Maps → Create index (Draw shapes), the new layer defaults to Scaling → Use vector tiles.
Adding label styling (Fixed or By value) previously did not display labels until the user manually changed Scaling to Limit results and back.
This PR makes labels appear immediately (after styling or save) on vector-tiles layers by:
with_labels=truewhen label styling is activescalingType: MVTthrough the MVT pipelineElastic’s
_mvtAPI returns suggested label points whenwith_labels=true; this wires Kibana to use that path and refresh tiles accordingly.Kibana’s Vector layer docs describe the scaling modes this aligns with.
What changed (files)
x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx• Snapshots the current label descriptor and
hasLabelsflag into the source request meta; any change invalidates the cached tiles and re-fetches through the MVT layer.x-pack/platform/plugins/shared/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.ts• Respect
isForceRefresh(was checking onlyforceRefreshDueToDrawing).• Generate a new token only when
hasLabelsor buffer change (prevents loops).• Include
with_labels=truein tile requests when label styling is active (Elasticsearch_mvtlabel points).x-pack/platform/plugins/shared/maps/public/classes/layers/wizards/new_vector_layer_wizard/wizard.tsx• When Create index uses MVT scaling, emit an MvtVectorLayer descriptor so the layer starts on the MVT pipeline and picks up the label-refresh logic.
Per Elastic’s docs, the vector-tile search API can return suggested label points when
with_labels=true; the Vector layer docs describe when to use Use vector tiles vs Limit results. This change wires Kibana’s MVT path to request tiles with labels and refresh them when styling/saving, so labels render without a scaling toggle.Why
During the Create index workflow, vector-tiles scaling is the default.
Tiles are built server-side from indexed data, so unsaved edits and label changes don’t show until tiles are refreshed.
By requesting tiles with labels and refreshing them on style or save, labels now render as expected without a manual scaling toggle.
Before / After
Before (GIF):

After (GIF):

Testing
This change was verified manually; no new unit or functional tests were added in this PR.
Manual validation steps
Test coverage note
Existing Jest tests for Maps layers and source syncing still pass.
Potential follow-ups:
isForceRefresh=truewith_labels=trueincluded in MVT tile requests when labels are activeRelease note
Fix: Labels in the Create index flow now render with the default Use vector tiles scaling as soon as label styling is applied (or after save), without requiring a scaling toggle.
Checklist
release_note:*,backport:*,review,community) will be applied by maintainers during triageIdentify risks
with_labelsadds small label points per tile; only used when labels are enabledValidation