[Lens] Fix palette switching on Partition charts#228051
[Lens] Fix palette switching on Partition charts#228051nickofthyme merged 3 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
💚 Build Succeeded
Metrics [docs]Async chunks
|
andrimal
left a comment
There was a problem hiding this comment.
Tested locally and the issue is fixed 🚀
|
Starting backport for target branches: 8.19, 9.1 |
## Summary Fixes issue in Lens Partition chart which prevented the user from switching legacy palettes. https://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0 Fixes elastic#227922 ## Details The issue here was that we are using `useDebouncedValue` which sets the value async. When the user selects a legacy palette we call `setLocalState` to set the palette then immediately call `setColorMapping` which was overriding the palette changes. Really we just need to clear the `colorMapping` when a `palette` is set. Instead of doing this every time the palette is set, I added the `onModeChange` callback to clear the `colorMapping` once when the mode is set to legacy. ## Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ## Release Notes Fixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the user from selecting a legacy palette. (cherry picked from commit 3cd7dec)
## Summary Fixes issue in Lens Partition chart which prevented the user from switching legacy palettes. https://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0 Fixes elastic#227922 ## Details The issue here was that we are using `useDebouncedValue` which sets the value async. When the user selects a legacy palette we call `setLocalState` to set the palette then immediately call `setColorMapping` which was overriding the palette changes. Really we just need to clear the `colorMapping` when a `palette` is set. Instead of doing this every time the palette is set, I added the `onModeChange` callback to clear the `colorMapping` once when the mode is set to legacy. ## Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ## Release Notes Fixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the user from selecting a legacy palette. (cherry picked from commit 3cd7dec)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…8242) # Backport This will backport the following commits from `main` to `9.1`: - [[Lens] Fix palette switching on Partition charts (#228051)](#228051) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-07-16T14:48:27Z","message":"[Lens] Fix palette switching on Partition charts (#228051)\n\n## Summary\n\nFixes issue in Lens Partition chart which prevented the user from\nswitching legacy palettes.\n\n\nhttps://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0\n\nFixes #227922\n\n## Details\n\nThe issue here was that we are using `useDebouncedValue` which sets the\nvalue async. When the user selects a legacy palette we call\n`setLocalState` to set the palette then immediately call\n`setColorMapping` which was overriding the palette changes.\n\nReally we just need to clear the `colorMapping` when a `palette` is set.\nInstead of doing this every time the palette is set, I added the\n`onModeChange` callback to clear the `colorMapping` once when the mode\nis set to legacy.\n\n## Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n## Release Notes\n\nFixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the\nuser from selecting a legacy palette.","sha":"3cd7dec0edb9c761acb7409dfda5edd4b0f66c23","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Lens] Fix palette switching on Partition charts","number":228051,"url":"https://github.com/elastic/kibana/pull/228051","mergeCommit":{"message":"[Lens] Fix palette switching on Partition charts (#228051)\n\n## Summary\n\nFixes issue in Lens Partition chart which prevented the user from\nswitching legacy palettes.\n\n\nhttps://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0\n\nFixes #227922\n\n## Details\n\nThe issue here was that we are using `useDebouncedValue` which sets the\nvalue async. When the user selects a legacy palette we call\n`setLocalState` to set the palette then immediately call\n`setColorMapping` which was overriding the palette changes.\n\nReally we just need to clear the `colorMapping` when a `palette` is set.\nInstead of doing this every time the palette is set, I added the\n`onModeChange` callback to clear the `colorMapping` once when the mode\nis set to legacy.\n\n## Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n## Release Notes\n\nFixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the\nuser from selecting a legacy palette.","sha":"3cd7dec0edb9c761acb7409dfda5edd4b0f66c23"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/228051","number":228051,"mergeCommit":{"message":"[Lens] Fix palette switching on Partition charts (#228051)\n\n## Summary\n\nFixes issue in Lens Partition chart which prevented the user from\nswitching legacy palettes.\n\n\nhttps://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0\n\nFixes #227922\n\n## Details\n\nThe issue here was that we are using `useDebouncedValue` which sets the\nvalue async. When the user selects a legacy palette we call\n`setLocalState` to set the palette then immediately call\n`setColorMapping` which was overriding the palette changes.\n\nReally we just need to clear the `colorMapping` when a `palette` is set.\nInstead of doing this every time the palette is set, I added the\n`onModeChange` callback to clear the `colorMapping` once when the mode\nis set to legacy.\n\n## Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n## Release Notes\n\nFixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the\nuser from selecting a legacy palette.","sha":"3cd7dec0edb9c761acb7409dfda5edd4b0f66c23"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
## Summary Fixes issue in Lens Partition chart which prevented the user from switching legacy palettes. https://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0 Fixes elastic#227922 ## Details The issue here was that we are using `useDebouncedValue` which sets the value async. When the user selects a legacy palette we call `setLocalState` to set the palette then immediately call `setColorMapping` which was overriding the palette changes. Really we just need to clear the `colorMapping` when a `palette` is set. Instead of doing this every time the palette is set, I added the `onModeChange` callback to clear the `colorMapping` once when the mode is set to legacy. ## Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ## Release Notes Fixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the user from selecting a legacy palette.
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…28241) # Backport This will backport the following commits from `main` to `8.19`: - [[Lens] Fix palette switching on Partition charts (#228051)](#228051) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-07-16T14:48:27Z","message":"[Lens] Fix palette switching on Partition charts (#228051)\n\n## Summary\n\nFixes issue in Lens Partition chart which prevented the user from\nswitching legacy palettes.\n\n\nhttps://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0\n\nFixes #227922\n\n## Details\n\nThe issue here was that we are using `useDebouncedValue` which sets the\nvalue async. When the user selects a legacy palette we call\n`setLocalState` to set the palette then immediately call\n`setColorMapping` which was overriding the palette changes.\n\nReally we just need to clear the `colorMapping` when a `palette` is set.\nInstead of doing this every time the palette is set, I added the\n`onModeChange` callback to clear the `colorMapping` once when the mode\nis set to legacy.\n\n## Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n## Release Notes\n\nFixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the\nuser from selecting a legacy palette.","sha":"3cd7dec0edb9c761acb7409dfda5edd4b0f66c23","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Lens] Fix palette switching on Partition charts","number":228051,"url":"https://github.com/elastic/kibana/pull/228051","mergeCommit":{"message":"[Lens] Fix palette switching on Partition charts (#228051)\n\n## Summary\n\nFixes issue in Lens Partition chart which prevented the user from\nswitching legacy palettes.\n\n\nhttps://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0\n\nFixes #227922\n\n## Details\n\nThe issue here was that we are using `useDebouncedValue` which sets the\nvalue async. When the user selects a legacy palette we call\n`setLocalState` to set the palette then immediately call\n`setColorMapping` which was overriding the palette changes.\n\nReally we just need to clear the `colorMapping` when a `palette` is set.\nInstead of doing this every time the palette is set, I added the\n`onModeChange` callback to clear the `colorMapping` once when the mode\nis set to legacy.\n\n## Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n## Release Notes\n\nFixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the\nuser from selecting a legacy palette.","sha":"3cd7dec0edb9c761acb7409dfda5edd4b0f66c23"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/228051","number":228051,"mergeCommit":{"message":"[Lens] Fix palette switching on Partition charts (#228051)\n\n## Summary\n\nFixes issue in Lens Partition chart which prevented the user from\nswitching legacy palettes.\n\n\nhttps://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0\n\nFixes #227922\n\n## Details\n\nThe issue here was that we are using `useDebouncedValue` which sets the\nvalue async. When the user selects a legacy palette we call\n`setLocalState` to set the palette then immediately call\n`setColorMapping` which was overriding the palette changes.\n\nReally we just need to clear the `colorMapping` when a `palette` is set.\nInstead of doing this every time the palette is set, I added the\n`onModeChange` callback to clear the `colorMapping` once when the mode\nis set to legacy.\n\n## Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n## Release Notes\n\nFixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the\nuser from selecting a legacy palette.","sha":"3cd7dec0edb9c761acb7409dfda5edd4b0f66c23"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
## Summary Fixes issue in Lens Partition chart which prevented the user from switching legacy palettes. https://github.com/user-attachments/assets/1cc3d222-f823-4135-9fde-257b75ebfbe0 Fixes elastic#227922 ## Details The issue here was that we are using `useDebouncedValue` which sets the value async. When the user selects a legacy palette we call `setLocalState` to set the palette then immediately call `setColorMapping` which was overriding the palette changes. Really we just need to clear the `colorMapping` when a `palette` is set. Instead of doing this every time the palette is set, I added the `onModeChange` callback to clear the `colorMapping` once when the mode is set to legacy. ## Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ## Release Notes Fixes an issue where a Lens Partition chart (i.e. `Pie`) prevented the user from selecting a legacy palette.
Summary
Fixes issue in Lens Partition chart which prevented the user from switching legacy palettes.
Zight.Recording.2025-07-15.at.10.00.38.AM.mp4
Fixes #227922
Details
The issue here was that we are using
useDebouncedValuewhich sets the value async. When the user selects a legacy palette we callsetLocalStateto set the palette then immediately callsetColorMappingwhich was overriding the palette changes.Really we just need to clear the
colorMappingwhen apaletteis set. Instead of doing this every time the palette is set, I added theonModeChangecallback to clear thecolorMappingonce when the mode is set to legacy.Checklist
backport:*labels.Release Notes
Fixes an issue where a Lens Partition chart (i.e.
Pie) prevented the user from selecting a legacy palette.