How to remove or update existing Decoration.mark

I am using code mirror 6 single line editor. added Decoration mark. after added mark. need to update few custom attributes of the mark. I used below code and it’s appending existing span. could you pls help

const decoSet = Decoration.set([newDeco.range(from, to)]);
const updateDecoEffect = StateEffect.appendConfig.of([
EditorView.decorations.of(decoSet)
]);
authDetailEditor.dispatch({ effects: updateDecoEffect });

appendConfig on the decorations facet is not a good way to add decorations to an editor. As you noticed, those aren’t static config values that stick around, but need to be updated to map them and to remove decorations. You’ll want to store your decoration set in a state field (or view plugin), where you can control and update its value, as in the decoration examples.