Skip to content

Add simpler way to use Component#27664

Merged
CraigMacomber merged 5 commits into
microsoft:mainfrom
CraigMacomber:simpleComponet
Jul 15, 2026
Merged

Add simpler way to use Component#27664
CraigMacomber merged 5 commits into
microsoft:mainfrom
CraigMacomber:simpleComponet

Conversation

@CraigMacomber

@CraigMacomber CraigMacomber commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

Add overload and default parameters to easy simple case use of Component API

Reviewer Guidance

The review process is outlined on this wiki page.

@CraigMacomber
CraigMacomber requested a review from a team as a code owner July 9, 2026 21:34
Copilot AI review requested due to automatic review settings July 9, 2026 21:34
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (300 lines, 6 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

@CraigMacomber CraigMacomber changed the title SimpleComponet Add simpler way to use Component Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Comment thread packages/dds/tree/src/componentApi.ts Outdated
allComponents: readonly Factory<TComponent, TConfig>[],
lazyConfiguration: (composed: ComposedComponents<TComponent, TConfig>) => TConfig = (
composed,
) => composed as unknown as TConfig,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally don't like overloads as they add this kind of non-type safe stuff.

In this case the other option is two differently named functions (since generic inference won't let you get away with one generic function for this)

I'm thinking maybe simply "compose" and "composeCustom". These seem fine especially given the functions are nested in a namespace already, which avoids the issue of having a top level too generic sounding compose, and makes the "custom" one not have too long of a name.

Thoughts on which is better?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like the user-experience of overloads for discoverability, but I agree that in this case (especially with the proposed naming) it matters less since intellisense will surface both options for autocomplete and such.

So, I guess I have a slight preference for the overloads, given that we only need the one type-cast, but I'd be fine with either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept the overload, but did the renames to the shorter name.

@CraigMacomber
CraigMacomber requested a review from a team as a code owner July 10, 2026 18:59
@github-actions

Copy link
Copy Markdown
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-website@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-website@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  298156 links
    1937 destination URLs
    2187 URLs ignored
       0 warnings
       0 errors


@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: e9b86c7d7a68dc4015f3d786c22d80c93570249b
Head commit: f745168e6750a2b12abce5ec08de8320eb024325

Notable changes

No bundles changed by ≥ 500 bytes parsed.

Per-bundle deltas

@fluid-example/bundle-size-tests

  • azureClient.js: parsed 619911 → 619967 (+56), gzip 164958 → 165003 (+45)
  • odspClient.js: parsed 592637 → 592693 (+56), gzip 159070 → 159114 (+44)
  • aqueduct.js: parsed 526400 → 526435 (+35), gzip 140839 → 140871 (+32)
  • fluidFramework.js: parsed 394730 → 394751 (+21), gzip 112076 → 112092 (+16)
  • sharedTree.js: parsed 384117 → 384131 (+14), gzip 109461 → 109471 (+10)
  • containerRuntime.js: parsed 304750 → 304764 (+14), gzip 83332 → 83340 (+8)
  • sharedString.js: parsed 175984 → 175991 (+7), gzip 49445 → 49453 (+8)
  • experimentalSharedTree.js: parsed 160798 → 160798 (0), gzip 45804 → 45804 (0)
  • matrix.js: parsed 159845 → 159852 (+7), gzip 45411 → 45418 (+7)
  • loader.js: parsed 145256 → 145270 (+14), gzip 39063 → 39076 (+13)
  • odspDriver.js: parsed 104329 → 104350 (+21), gzip 32625 → 32635 (+10)
  • directory.js: parsed 66616 → 66623 (+7), gzip 18532 → 18540 (+8)
  • 748.js: parsed 58793 → 58793 (0), gzip 17827 → 17827 (0)
  • map.js: parsed 46709 → 46716 (+7), gzip 14310 → 14318 (+8)
  • odspPrefetchSnapshot.js: parsed 45642 → 45656 (+14), gzip 15277 → 15285 (+8)
  • 985.js: parsed 44491 → 44491 (0), gzip 13726 → 13726 (0)
  • summarizerDelayLoadedModule.js: parsed 30749 → 30749 (0), gzip 7753 → 7753 (0)
  • socketModule.js: parsed 26476 → 26483 (+7), gzip 7887 → 7894 (+7)
  • createNewModule.js: parsed 12480 → 12480 (0), gzip 4786 → 4786 (0)
  • summaryModule.js: parsed 3797 → 3797 (0), gzip 1860 → 1860 (0)
  • connectionState.js: parsed 724 → 724 (0), gzip 429 → 429 (0)
  • sharedTreeAttributes.js: parsed 666 → 673 (+7), gzip 432 → 442 (+10)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 422 → 422 (0), gzip 316 → 316 (0)

@Josmithr Josmithr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a notable simplification, in my opinion. I still worry about how approachable this API is overall, but this is definitely better.

@CraigMacomber

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service rerun

@CraigMacomber
CraigMacomber merged commit 393ccf3 into microsoft:main Jul 15, 2026
36 checks passed
@CraigMacomber
CraigMacomber deleted the simpleComponet branch July 15, 2026 23:29
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.

3 participants