refactor(tree): Reserve positional argument in treeChanged event listener signature - #27951
refactor(tree): Reserve positional argument in treeChanged event listener signature#27951Joshua Smithrud (Josmithr) wants to merge 6 commits into
treeChanged event listener signature#27951Conversation
…stener signature
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (59 lines, 12 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
Pull request overview
This PR updates the stable Simple Tree treeChanged event listener signature to reserve a positional argument (unstable?: unknown) for potential future/experimental event payloads, aligning it with the existing approach used by nodeChanged.
Changes:
- Updates
TreeChangeEvents.treeChangedtotreeChanged(unstable?: unknown): voidand documents the reserved-argument guidance. - Regenerates API reports across
@fluidframework/treeand thefluid-frameworkumbrella package to reflect the new signature. - Adds a changeset announcing the minor-version API surface change and providing migration guidance for listeners.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/dds/tree/src/simple-tree/api/treeChangeEvents.ts | Updates treeChanged signature and adds reserved-argument documentation (plus minor doc cleanup). |
| packages/dds/tree/api-report/tree.public.api.md | API report update for TreeChangeEvents.treeChanged signature. |
| packages/dds/tree/api-report/tree.legacy.public.api.md | Legacy API report update for TreeChangeEvents.treeChanged signature. |
| packages/dds/tree/api-report/tree.legacy.beta.api.md | Legacy beta API report update for TreeChangeEvents.treeChanged signature. |
| packages/dds/tree/api-report/tree.beta.api.md | Beta API report update for TreeChangeEvents.treeChanged signature. |
| packages/dds/tree/api-report/tree.alpha.api.md | Alpha API report update for TreeChangeEvents.treeChanged signature. |
| packages/framework/fluid-framework/api-report/fluid-framework.public.api.md | Umbrella package API report update mirroring the TreeChangeEvents.treeChanged signature change. |
| packages/framework/fluid-framework/api-report/fluid-framework.legacy.public.api.md | Umbrella legacy API report update mirroring the signature change. |
| packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md | Umbrella legacy beta API report update mirroring the signature change. |
| packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md | Umbrella beta API report update mirroring the signature change. |
| packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md | Umbrella alpha API report update mirroring the signature change. |
| .changeset/reserve-tree-changed-argument.md | Changeset documenting the reserved argument, runtime behavior, and safe listener patterns. |
Suppressed comments (1)
packages/dds/tree/src/simple-tree/api/treeChangeEvents.ts:103
- Same grammar issue as above ("added from breaking"). Rephrase so the guidance reads clearly and avoids ungrammatical wording.
* Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this where
* arguments are added from breaking due to optional arguments.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| The event's runtime behavior has not changed, but the declaration reserves that position for event data that experimental or future APIs may provide. | ||
|
|
||
| Most listeners require no changes. | ||
| Listeners that declare their own optional first parameter should remove it or use a wrapper so they do not interpret event data as application data. |
There was a problem hiding this comment.
Might be worth adjusting the phrasing in this changeset to better communicate that this is not changing runtime behavior, and the runtime behavior which such code would mishandle is already happening.
|
🔗 Found some broken links! 💔 Run a link check locally to find them. See Checking for Broken Links for more information. linkcheck output |
Bundle size comparisonBase commit: Notable changesNo bundles changed by ≥ 500 bytes parsed. Per-bundle deltas
|
TreeAlpha'streeChangedevents already propogate delta events through this surface at runtime, so this is strictly formalizing an expectation that must already be satisfied to in order to safely use these events.