Currently, when there is the last decoration on screen and you remove the associated color, you will find the decoration still exist in document, but it should be removed.
This is because when decorations changed from an array with elements to an empty array, the setDecorations method will not be triggered, until it has elements again, and caused this issue.
I believe remove the if clause can fix this issue without any potential risk.
Currently, when there is the last decoration on screen and you remove the associated color, you will find the decoration still exist in document, but it should be removed.
This is because when
decorations
changed from an array with elements to an empty array, thesetDecorations
method will not be triggered, until it has elements again, and caused this issue.I believe remove the if clause can fix this issue without any potential risk.
Please take a look, thanks