-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
initialRoot
option for Document attachment (#913)
This change introduces an option to set initial document values during attachment, eliminating the need for manual initialization after attachment. The feature streamlines document setup by: - Allowing predefined document structures during attachment - Ensuring consistent initial state across document instances - Reducing boilerplate code previously needed for initialization Before: ``` const doc = new yorkie.Document('key'); await client.attach(doc); doc.update((root) => { if(!root.content) { root.content = new yorkie.Text(); } }); ``` After: ``` const doc = new yorkie.Document('key'); await client.attach(doc, { initialRoot: { content: new yorkie.Text(); } }); ``` --------- Co-authored-by: Youngteac Hong <[email protected]>
- Loading branch information
1 parent
f292077
commit bd5e50f
Showing
2 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters