Skip to content

Commit

Permalink
[fix] Text labels: can't set prop to false/0 with multiple labels (#2354
Browse files Browse the repository at this point in the history
)
  • Loading branch information
igorDykhta committed Oct 3, 2023
1 parent 357f77a commit cfee75a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/reducers/src/vis-state-updaters.ts
Expand Up @@ -575,11 +575,11 @@ function updateTextLabelPropAndValue(idx, prop, value, textLabel) {

let newTextLabel = textLabel.slice();

if (prop && (value || textLabel.length === 1)) {
newTextLabel = textLabel.map((tl, i) => (i === idx ? {...tl, [prop]: value} : tl));
} else if (prop === 'field' && value === null && textLabel.length > 1) {
if (prop === 'field' && value === null && textLabel.length > 1) {
// remove label when field value is set to null
newTextLabel.splice(idx, 1);
} else if (prop) {
newTextLabel = textLabel.map((tl, i) => (i === idx ? {...tl, [prop]: value} : tl));
}

return newTextLabel;
Expand Down

0 comments on commit cfee75a

Please sign in to comment.