mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
add comments
This commit is contained in:
parent
1419f17175
commit
a0669f874e
2 changed files with 12 additions and 0 deletions
|
@ -263,9 +263,14 @@ export class App extends React.Component<any, AppState> {
|
|||
sceneAppState || getDefaultAppState(),
|
||||
{ scrollToContent: true },
|
||||
);
|
||||
// Perform reconciliation - in collaboration, if we encounter
|
||||
// elements with more staler versions than ours, ignore them
|
||||
// and keep ours.
|
||||
if (elements == null || elements.length === 0) {
|
||||
elements = restoredState.elements;
|
||||
} else {
|
||||
// create a map of ids so we don't have to iterate
|
||||
// over the array more than once.
|
||||
const elementMap = elements.reduce(
|
||||
(
|
||||
acc: { [key: string]: ExcalidrawElement },
|
||||
|
@ -276,6 +281,7 @@ export class App extends React.Component<any, AppState> {
|
|||
},
|
||||
{},
|
||||
);
|
||||
// Reconcile
|
||||
elements = restoredState.elements.map(element => {
|
||||
if (
|
||||
elementMap.hasOwnProperty(element.id) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue