Skip to content

Commit a58f43b

Browse files
authored
Merge pull request #55 from webdoc-js/fix/clone-doc
Assign new ID in cloneDoc
2 parents f8e4e64 + bf96786 commit a58f43b

File tree

1 file changed

+6
-1
lines changed
  • packages/webdoc-model/src

1 file changed

+6
-1
lines changed

packages/webdoc-model/src/doc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,12 @@ export function addDoc<T: Doc>(doc: T, root: Doc): ?T {
304304
*/
305305
export function cloneDoc<T: Doc>(doc: T): T {
306306
// $FlowFixMe
307-
return Object.assign({}, doc, {children: [], members: [], parent: undefined});
307+
return Object.assign({}, doc, {
308+
id: nanoid(),
309+
children: [],
310+
members: [],
311+
parent: undefined,
312+
});
308313
}
309314

310315
/**

0 commit comments

Comments
 (0)