nteract / semiotic

A data visualization framework combining React & D3
https://semioticv1.nteract.io/
Other
2.43k stars 133 forks source link

fix the annotation object merge #513

Closed ShadyStego closed 4 years ago

ShadyStego commented 4 years ago

This is an attempt to fix a bug documented in issue-495.

emeeks commented 4 years ago

@torioLuz would this be resolved by replacing Object.assign() with destructuring the objects in a new object? Like this: { ...adjustableAnnotations[i].props.noteData, ...otherProps }

Object.assign is amending props, and I can see why that might not trigger an update. But I didn't even realize there was a bug here, so just wanted to get some context.

ShadyStego commented 4 years ago

That should work. I wasn't sure if there's any specific reason why only nx, ny, and note are overridden, hence the only thing I did to fix this was flipping the old object and the new object. Previously the code overrides the new props with the old props, which is why it is not updating the note as intended.