mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-02-18 13:29:36 +01:00
add explanation for why we mutate collaborators state (#2028)
* 🔒 Avoid mutating state
* revert to mutation and add explaining comment
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
5670c47789
commit
2cb8ba6521
@ -1299,6 +1299,8 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||||||
username,
|
username,
|
||||||
selectedElementIds,
|
selectedElementIds,
|
||||||
} = decryptedData.payload;
|
} = decryptedData.payload;
|
||||||
|
// NOTE purposefully mutating collaborators map in case of
|
||||||
|
// pointer updates so as not to trigger LayerUI rerender
|
||||||
this.setState((state) => {
|
this.setState((state) => {
|
||||||
if (!state.collaborators.has(socketID)) {
|
if (!state.collaborators.has(socketID)) {
|
||||||
state.collaborators.set(socketID, {});
|
state.collaborators.set(socketID, {});
|
||||||
|
Loading…
Reference in New Issue
Block a user