sdk icon indicating copy to clipboard operation
sdk copied to clipboard

`assignTags` cannot be safely called twice

Open aiwilliams opened this issue 3 years ago • 1 comments

When the function processes values in a map of key/value pairs, when the value is a boolean, it will add the name of the tag to the entity's tags array, such as:

const tagMap = { Owner: 'true' };
assignTags(entity, tagMap);
// entity.tags === ['Owner']

When the function is called twice, in situations where there are two or more sources of tags, it will overwrite the tags property when that boolean trick has been triggered.

  • [ ] Add to existing tags values
  • [ ] A second call with { Owner: 'false' } does not need to remove 'Owner' from the tags

aiwilliams avatar Apr 20 '21 16:04 aiwilliams