Skip to content

Conversation

@zxch3n
Copy link
Member

@zxch3n zxch3n commented Sep 3, 2025

No description provided.

zxch3n added 9 commits August 28, 2025 23:10
…h creates

- Add onCreate callback to tree-create changes (diff.ts) to:
    - write the assigned TreeID back into the new state node
    - retarget queued child creates’ parent to the freshly created parent ID
- Apply tree creates in order and invoke onCreate immediately after createNode (mirror.ts)
to ensure children receive the correct parent ID in the same update
- Document Tree create ordering & IDs in README with example (incl. Chinese note)
- Improve type checks: isValueOfContainerType recognizes array shapes for List/Tree (utils.ts)
- Add comments and optional debug divergence check for Tree updates (mirror.ts)
- Update tests for tree behavior and quoting consistency

Rationale: users cannot know new TreeIDs ahead of time; when creating a parent and its children
together, the parent’s ID is unknown at diff time. The onCreate hook backfills IDs and patches
child parent references to keep state and Loro in sync without rebuilding entire subtrees.
@zxch3n zxch3n merged commit 3990702 into main Sep 3, 2025
1 check passed
@zxch3n zxch3n deleted the feat-tree branch September 3, 2025 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant