Skip to content

Add simpler way to use Component#27664

Open
CraigMacomber wants to merge 3 commits into
microsoft:mainfrom
CraigMacomber:simpleComponet
Open

Add simpler way to use Component#27664
CraigMacomber wants to merge 3 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:
  294296 links
    1937 destination URLs
    2187 URLs ignored
       0 warnings
       0 errors


@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: ed439e5ce5b4c6e1aec2c8aff8662e8989ad270f
Head commit: 2f046969c4fc5602f335665dc6b0c4d34f116aa4

⚠️ Comparison unavailable.

The PR's CI build failed — fix the build and the comment will update once the next run succeeds.

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