Skip to content

Add Copilot Component templates (minimal, no-framework, react) - #265

Open
svalenciasan wants to merge 9 commits into
SharePoint:mainfrom
svalenciasan:copilot-component-template-fork
Open

Add Copilot Component templates (minimal, no-framework, react)#265
svalenciasan wants to merge 9 commits into
SharePoint:mainfrom
svalenciasan:copilot-component-template-fork

Conversation

@svalenciasan

Copy link
Copy Markdown

Description

Adds a full set of Copilot Component templates to the SPFx template system and brings them up to date with the newer reference implementations in odsp-web.

This builds on and supersedes #256 (which added copilot-component-minimal). It is based on that work (the original minimal template commit is included in this branch) and then:

  • Aligns the SPFx version used by the copilot templates to 1.24.0-beta.2 — the newest line that is actually published to public npm for all required @microsoft/* packages (the repo's other templates track 1.23.2, which is not published for @microsoft/sp-copilot-component).
  • Updates copilot-component-minimal to match the current odsp-web behavior: renders this.properties.message, uses the default zodToJsonSchema import with a compile-clean zod 3.24.1 / zod-to-json-schema 3.24.1 pair, fixes @types/heft-jest@types/jest, bumps the agent schemas (Teams manifest v1.29, declarative agent v1.8, ai-plugin v2.4), points the serve page at CopilotWorkbench.aspx, and adds tsconfig watchOptions to avoid the copilot-agent build loop.
  • Adds copilot-component-noframework (migrated from the odsp "none" template): an HTML/CSS sample that reads host theme/display mode, shows a welcome image, and exposes an expand-to-fullscreen control. Includes .module.scss + sass.json, localization (loc/, typescript.json static assets, config.json localizedResources), and images.d.ts.
  • Adds copilot-component-react (migrated from the odsp react template): fetches the current user (Microsoft Graph /me) and site (SharePoint REST) via brokered SSO, then mounts a Fluent UI v9 React tree with host-context badges and four bridge actions (expand, open link, follow-up message, resize).

This effectively migrates the odsp-web Yeoman copilot templates to the spfx repo template system so the odsp version can be deprecated.

Notes for reviewers

  • Conventions: these follow spfx repo conventions, not odsp's — flat src/, .eslintrc.js (+ eslint 8), published-version deps via <%= spfxVersion %>, the spfx rig, and _phase:* scripts. No .yo-rc.json / yeoman artifacts. A dependency is added only when the migrated source actually imports it.
  • Version allowlist: common/config/rush/common-versions.json allowlists the copilot templates' 1.24.0-beta.2 SPFx packages, @microsoft/sp-lodash-subset, and zod 3.24.1, since the copilot line intentionally tracks a newer SPFx than the other templates.
  • copilot-component-minimal example is now registered in rush.json (previously blocked because @microsoft/sp-copilot-component was unpublished; it is now published at 1.24.0-beta.2).
  • The react example uses component name Sample to avoid colliding with the import * as React from 'react' symbol.
  • teams/<solution>-agent.zip is a copilot-agent build artifact and is gitignored (not committed).

Relationship to #256: this can supersede it, or #256 can be closed in its favor — whichever the maintainers prefer.

How was this tested?

  • rush build — all 22 projects build, including the three new copilot examples.
  • cd tests/spfx-template-test && heft test --clean — 22/22 pass (21 template scaffolds + 1 multi-component); snapshots and examples/ golden copies regenerated from the templates via the CLI in CI mode.
  • rush check — no dependency mismatches.
  • Working tree is clean after a build (agent-zip artifacts ignored).
  • Each example was individually built against the published 1.24.0-beta.2 packages to confirm the migrated samples compile (including the Fluent UI v9 / sp-http / bridge react sample).

Type of change

  • Bug fix
  • New feature / enhancement
  • Template change
  • Documentation / CI / governance

nick-pape and others added 7 commits June 3, 2026 11:16
Adds a new "copilot" template category and a minimal Copilot Component
template based on the greeting-copilot-component reference implementation.
The template scaffolds a hello-world CopilotComponent with Zod-based
properties schema, declarative agent manifests, and copilot agent config.

Note: the example is not registered in rush.json because
@microsoft/sp-copilot-component has not been published yet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…template-fork

# Conflicts:
#	tests/spfx-template-test/src/tests/__snapshots__/multi-component.test.ts.snap
#	tests/spfx-template-test/src/tests/__snapshots__/templates.test.ts.snap
Bumps spfxVersion in the copilot-component-minimal template.json from
1.22.2 to 1.24.0-beta.2 and regenerates the example from the template
(package.json deps, package-solution mpnId, README version badge).
Updates the spfx-template-test snapshots to reflect the new version in
the template listing table.
- Component renders this.properties.message (matches odsp minimal sample)
- Properties.ts: default import zodToJsonSchema, generic propertiesSchema, pin
  zod + zod-to-json-schema to 3.24.1 (the odsp-proven, compile-clean pair)
- Fix devDeps: @types/heft-jest -> @types/jest ~30.0.0; @rushstack/heft ^1.2.19
- copilot/: bump schemas (Teams v1.29, declarative agent v1.8, ai-plugin v2.4)
  and generalize instruction.txt
- serve.json: initialPage -> CopilotWorkbench.aspx
- tsconfig.json: add watchOptions to avoid copilot-agent build loop
- Register example in rush.json; allowlist zod 3.24.1 + SPFx 1.24.0-beta.2 in
  common-versions.json; regenerate example and snapshots
Rich no-framework Copilot Component sample migrated from odsp-web, adapted to
spfx conventions (flat src/, .eslintrc.js, published-version deps):
- HTML/CSS render with theme/display-mode details, welcome image, and an
  expand-to-fullscreen control (requestDisplayModeAsync)
- .module.scss + config/sass.json; loc/ localization + config/typescript.json
  staticAssetsToCopy + config.json localizedResources; src/images.d.ts for png
- deps: add @microsoft/sp-lodash-subset (escape); allowlist it at 1.24.0-beta.2
- Register example in rush.json + templates.test.ts; example builds and snapshot
  test passes (21 total)
React-based Copilot Component sample migrated from odsp-web, adapted to spfx
conventions (flat src/, .eslintrc.js react profile, published-version deps):
- Main component fetches user (Graph /me) + site (SharePoint REST) via brokered
  SSO, then mounts a Fluent UI v9 React tree; unmounts on teardown
- components/<Name>.tsx: FluentProvider theming + host-context badges + four
  bridge actions (expand, open link, follow-up message, resize)
- loc/ localization + config/typescript.json staticAssetsToCopy + config.json
  localizedResources
- deps: react/react-dom 17, @fluentui/react-components v9, @fluentui/react-icons,
  @microsoft/sp-http, eslint-plugin-react(-hooks); @types/react resolutions
- Register example in rush.json + templates.test.ts (component name 'Sample' to
  avoid colliding with the React import); example builds; suite green (22 total)
The copilot-agent Heft plugin emits teams/<solution>-agent.zip during build.
These are build artifacts, not part of the scaffold, so add teams/ to the
copilot template .gitignore and untrack the accidentally-committed zips.
Copilot AI review requested due to automatic review settings July 31, 2026 15:00

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.

Pull request overview

This pull request adds a new “copilot” template category and introduces a full set of SPFx Copilot Component templates (minimal, no-framework, react), along with corresponding examples and test/snapshot updates to validate scaffolding and template listing behavior.

Changes:

  • Added three Copilot Component templates (minimal / no-framework / react) plus corresponding examples/ projects and Rush registration.
  • Extended template category validation to include copilot and updated template-test coverage/snapshots to include the new templates.
  • Updated dependency governance to allow the Copilot templates’ newer SPFx line (1.24.0-beta.2) and zod@3.24.1.

Reviewed changes

Copilot reviewed 136 out of 160 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
tests/spfx-template-test/src/tests/templates.test.ts Registers the three copilot templates for scaffolding tests.
tests/spfx-template-test/src/tests/snapshots/multi-component.test.ts.snap Updates snapshots to reflect the increased template count and listing output.
templates/copilot-component-react/tsconfig.json Adds watch exclusions to prevent copilot-agent build/watch loops.
templates/copilot-component-react/template.json Declares the react copilot template metadata (category/version/SPFx version).
templates/copilot-component-react/src/loc/en-us.js Adds localized UI strings for the react sample.
templates/copilot-component-react/src/loc/{componentName.camel}CopilotComponentStrings.d.ts Declares TypeScript typings for localized strings.
templates/copilot-component-react/src/components/I{componentName.pascal}Props.ts Defines React component props contract for the template.
templates/copilot-component-react/src/components/{componentName.pascal}.tsx Implements the React UI that exercises bridge actions + theming.
templates/copilot-component-react/src/{componentName.pascal}Properties.ts Adds zod schema + JSON schema export for tool properties.
templates/copilot-component-react/src/{componentName.pascal}CopilotComponent.tsx Implements the SPFx CopilotComponent host that fetches user/site and renders React.
templates/copilot-component-react/src/{componentName.hyphen}-copilot-component.manifest.json Adds Copilot component manifest with tool + display mode capabilities.
templates/copilot-component-react/README.md Provides template README scaffold and feature bullets.
templates/copilot-component-react/package.json Defines template dependencies (Fluent UI v9, zod, SPFx packages).
templates/copilot-component-react/copilot/manifest.json Adds Teams manifest for the declarative agent packaging.
templates/copilot-component-react/copilot/instruction.txt Adds agent instruction text for the template.
templates/copilot-component-react/copilot/declarativeAgent.json Adds declarative agent definition referencing the action plugin.
templates/copilot-component-react/copilot/ai-plugin.json Adds Copilot plugin action metadata (schema v2.4).
templates/copilot-component-react/config/typescript.json Ensures localization JS is copied as static assets.
templates/copilot-component-react/config/serve.json Sets CopilotWorkbench initial page for local serve.
templates/copilot-component-react/config/rig.json Uses the SPFx build rig for config resolution.
templates/copilot-component-react/config/package-solution.json Defines solution packaging settings for the template.
templates/copilot-component-react/config/copilot-agent.json Defines agent registration mapping to the component id.
templates/copilot-component-react/config/config.json Configures bundle entrypoint and localized resources.
templates/copilot-component-react/.npmignore Controls which build outputs would be published.
templates/copilot-component-react/.gitignore Ignores build artifacts and copilot-agent outputs.
templates/copilot-component-react/.eslintrc.js Adds eslint configuration aligned to SPFx/react profile.
templates/copilot-component-noframework/tsconfig.json Adds watch exclusions to prevent copilot-agent build/watch loops.
templates/copilot-component-noframework/template.json Declares the noframework copilot template metadata.
templates/copilot-component-noframework/src/loc/en-us.js Adds localized strings for the noframework sample.
templates/copilot-component-noframework/src/loc/{componentName.camel}CopilotComponentStrings.d.ts Declares TypeScript typings for localized strings.
templates/copilot-component-noframework/src/images.d.ts Enables importing image assets in TypeScript.
templates/copilot-component-noframework/src/{componentName.pascal}Properties.ts Adds zod schema + JSON schema export for tool properties.
templates/copilot-component-noframework/src/{componentName.pascal}CopilotComponent.ts Implements HTML/CSS noframework CopilotComponent UI + fullscreen control.
templates/copilot-component-noframework/src/{componentName.pascal}CopilotComponent.module.scss Adds styling for the noframework UI (light/dark).
templates/copilot-component-noframework/src/{componentName.hyphen}-copilot-component.manifest.json Adds Copilot component manifest with tool + display mode capabilities.
templates/copilot-component-noframework/README.md Provides template README scaffold and feature bullets.
templates/copilot-component-noframework/package.json Defines template dependencies (SPFx packages, zod).
templates/copilot-component-noframework/copilot/manifest.json Adds Teams manifest for the declarative agent packaging.
templates/copilot-component-noframework/copilot/instruction.txt Adds agent instruction text for the template.
templates/copilot-component-noframework/copilot/declarativeAgent.json Adds declarative agent definition referencing the action plugin.
templates/copilot-component-noframework/copilot/ai-plugin.json Adds Copilot plugin action metadata (schema v2.4).
templates/copilot-component-noframework/config/typescript.json Ensures localization JS is copied as static assets.
templates/copilot-component-noframework/config/serve.json Sets CopilotWorkbench initial page for local serve.
templates/copilot-component-noframework/config/sass.json Enables sass plugin config for .module.scss.
templates/copilot-component-noframework/config/rig.json Uses the SPFx build rig for config resolution.
templates/copilot-component-noframework/config/package-solution.json Defines solution packaging settings for the template.
templates/copilot-component-noframework/config/copilot-agent.json Defines agent registration mapping to the component id.
templates/copilot-component-noframework/config/config.json Configures bundle entrypoint and localized resources.
templates/copilot-component-noframework/.npmignore Controls which build outputs would be published.
templates/copilot-component-noframework/.gitignore Ignores build artifacts and copilot-agent outputs.
templates/copilot-component-noframework/.eslintrc.js Adds eslint configuration aligned to SPFx default profile.
templates/copilot-component-minimal/tsconfig.json Adds watch exclusions to prevent copilot-agent build/watch loops.
templates/copilot-component-minimal/template.json Declares the minimal copilot template metadata.
templates/copilot-component-minimal/src/{componentName.pascal}Properties.ts Adds zod schema + JSON schema export for tool properties.
templates/copilot-component-minimal/src/{componentName.pascal}CopilotComponent.ts Implements minimal CopilotComponent that renders the message property.
templates/copilot-component-minimal/src/{componentName.hyphen}-copilot-component.manifest.json Adds Copilot component manifest with tool + display mode capabilities.
templates/copilot-component-minimal/README.md Provides template README scaffold and feature bullets.
templates/copilot-component-minimal/package.json Defines template dependencies (SPFx packages, zod).
templates/copilot-component-minimal/copilot/manifest.json Adds Teams manifest for the declarative agent packaging.
templates/copilot-component-minimal/copilot/instruction.txt Adds agent instruction text for the template.
templates/copilot-component-minimal/copilot/declarativeAgent.json Adds declarative agent definition referencing the action plugin.
templates/copilot-component-minimal/copilot/ai-plugin.json Adds Copilot plugin action metadata (schema v2.4).
templates/copilot-component-minimal/config/serve.json Sets CopilotWorkbench initial page for local serve.
templates/copilot-component-minimal/config/rig.json Uses the SPFx build rig for config resolution.
templates/copilot-component-minimal/config/package-solution.json Defines solution packaging settings for the template.
templates/copilot-component-minimal/config/copilot-agent.json Defines agent registration mapping to the component id.
templates/copilot-component-minimal/config/config.json Configures bundle entrypoint for the minimal template.
templates/copilot-component-minimal/.npmignore Controls which build outputs would be published.
templates/copilot-component-minimal/.gitignore Ignores build artifacts and copilot-agent outputs.
templates/copilot-component-minimal/.eslintrc.js Adds eslint configuration aligned to SPFx default profile.
rush.json Registers the three copilot examples as Rush projects.
examples/copilot-component-react/tsconfig.json Adds watch exclusions to prevent copilot-agent build/watch loops.
examples/copilot-component-react/src/SampleProperties.ts Adds zod schema + JSON schema export for example tool properties.
examples/copilot-component-react/src/SampleCopilotComponent.tsx Implements example CopilotComponent host that fetches user/site and renders React.
examples/copilot-component-react/src/sample-copilot-component.manifest.json Adds example Copilot component manifest with tool + properties schema reference.
examples/copilot-component-react/src/loc/sampleCopilotComponentStrings.d.ts Declares TypeScript typings for localized strings.
examples/copilot-component-react/src/loc/en-us.js Adds localized UI strings for the react example.
examples/copilot-component-react/src/components/Sample.tsx Implements React UI for the example (bridge actions + theming).
examples/copilot-component-react/src/components/ISampleProps.ts Defines React component props contract for the example.
examples/copilot-component-react/README.md Provides example README scaffold.
examples/copilot-component-react/package.json Defines example dependencies (Fluent UI v9, zod, SPFx packages).
examples/copilot-component-react/copilot/manifest.json Adds Teams manifest for the example agent packaging.
examples/copilot-component-react/copilot/instruction.txt Adds agent instruction text for the example.
examples/copilot-component-react/copilot/declarativeAgent.json Adds declarative agent definition referencing the example action plugin.
examples/copilot-component-react/copilot/ai-plugin.json Adds Copilot plugin action metadata (schema v2.4).
examples/copilot-component-react/config/typescript.json Ensures localization JS is copied as static assets.
examples/copilot-component-react/config/serve.json Sets CopilotWorkbench initial page for local serve.
examples/copilot-component-react/config/rig.json Uses the SPFx build rig for config resolution.
examples/copilot-component-react/config/package-solution.json Defines solution packaging settings for the example.
examples/copilot-component-react/config/copilot-agent.json Defines agent registration mapping to the component id.
examples/copilot-component-react/config/config.json Configures bundle entrypoint and localized resources for the example.
examples/copilot-component-react/.npmignore Controls which build outputs would be published.
examples/copilot-component-react/.gitignore Ignores build artifacts and copilot-agent outputs.
examples/copilot-component-react/.eslintrc.js Adds eslint configuration aligned to SPFx/react profile.
examples/copilot-component-noframework/tsconfig.json Adds watch exclusions to prevent copilot-agent build/watch loops.
examples/copilot-component-noframework/src/NoFrameworkProperties.ts Adds zod schema + JSON schema export for example tool properties.
examples/copilot-component-noframework/src/NoFrameworkCopilotComponent.ts Implements HTML/CSS noframework example + fullscreen control.
examples/copilot-component-noframework/src/NoFrameworkCopilotComponent.module.scss Adds styling for the noframework example UI (light/dark).
examples/copilot-component-noframework/src/no-framework-copilot-component.manifest.json Adds example Copilot component manifest with tool + properties schema reference.
examples/copilot-component-noframework/src/loc/noFrameworkCopilotComponentStrings.d.ts Declares TypeScript typings for localized strings.
examples/copilot-component-noframework/src/loc/en-us.js Adds localized strings for the noframework example.
examples/copilot-component-noframework/src/images.d.ts Enables importing image assets in TypeScript.
examples/copilot-component-noframework/README.md Provides example README scaffold.
examples/copilot-component-noframework/package.json Defines example dependencies (SPFx packages, zod).
examples/copilot-component-noframework/copilot/manifest.json Adds Teams manifest for the example agent packaging.
examples/copilot-component-noframework/copilot/instruction.txt Adds agent instruction text for the example.
examples/copilot-component-noframework/copilot/declarativeAgent.json Adds declarative agent definition referencing the example action plugin.
examples/copilot-component-noframework/copilot/ai-plugin.json Adds Copilot plugin action metadata (schema v2.4).
examples/copilot-component-noframework/config/typescript.json Ensures localization JS is copied as static assets.
examples/copilot-component-noframework/config/serve.json Sets CopilotWorkbench initial page for local serve.
examples/copilot-component-noframework/config/sass.json Enables sass plugin config for .module.scss.
examples/copilot-component-noframework/config/rig.json Uses the SPFx build rig for config resolution.
examples/copilot-component-noframework/config/package-solution.json Defines solution packaging settings for the example.
examples/copilot-component-noframework/config/copilot-agent.json Defines agent registration mapping to the component id.
examples/copilot-component-noframework/config/config.json Configures bundle entrypoint and localized resources for the example.
examples/copilot-component-noframework/.npmignore Controls which build outputs would be published.
examples/copilot-component-noframework/.gitignore Ignores build artifacts and copilot-agent outputs.
examples/copilot-component-noframework/.eslintrc.js Adds eslint configuration aligned to SPFx default profile.
examples/copilot-component-minimal/tsconfig.json Adds watch exclusions to prevent copilot-agent build/watch loops.
examples/copilot-component-minimal/src/MinimalProperties.ts Adds zod schema + JSON schema export for example tool properties.
examples/copilot-component-minimal/src/MinimalCopilotComponent.ts Implements minimal example CopilotComponent that renders the message property.
examples/copilot-component-minimal/src/minimal-copilot-component.manifest.json Adds example Copilot component manifest with tool + properties schema reference.
examples/copilot-component-minimal/README.md Provides example README scaffold.
examples/copilot-component-minimal/package.json Defines example dependencies (SPFx packages, zod).
examples/copilot-component-minimal/copilot/manifest.json Adds Teams manifest for the example agent packaging.
examples/copilot-component-minimal/copilot/instruction.txt Adds agent instruction text for the example.
examples/copilot-component-minimal/copilot/declarativeAgent.json Adds declarative agent definition referencing the example action plugin.
examples/copilot-component-minimal/copilot/ai-plugin.json Adds Copilot plugin action metadata (schema v2.4).
examples/copilot-component-minimal/config/serve.json Sets CopilotWorkbench initial page for local serve.
examples/copilot-component-minimal/config/rig.json Uses the SPFx build rig for config resolution.
examples/copilot-component-minimal/config/package-solution.json Defines solution packaging settings for the example.
examples/copilot-component-minimal/config/copilot-agent.json Defines agent registration mapping to the component id.
examples/copilot-component-minimal/config/config.json Configures bundle entrypoint for the minimal example.
examples/copilot-component-minimal/.npmignore Controls which build outputs would be published.
examples/copilot-component-minimal/.gitignore Ignores build artifacts and copilot-agent outputs.
examples/copilot-component-minimal/.eslintrc.js Adds eslint configuration aligned to SPFx default profile.
common/config/rush/repo-state.json Updates Rush repo-state hash due to dependency changes.
common/config/rush/common-versions.json Allowlists newer SPFx line and zod version for copilot templates.
common/changes/@microsoft/spfx-cli/add-copilot-component-template_2026-06-03.json Adds required Rush change file for the published package set.
apps/spfx-cli/README.md Adds Copilot Components section (template listing).
api/spfx-template-api/src/templating/SPFxTemplateJsonFile.ts Extends allowed template categories to include copilot.
api/spfx-template-api/etc/spfx-template-api.api.md Updates API report for the new copilot category literal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/spfx-cli/README.md
Comment thread examples/copilot-component-react/src/components/Sample.tsx
Comment thread templates/copilot-component-react/src/{componentName.pascal}CopilotComponent.tsx Outdated
Comment thread templates/copilot-component-react/src/{componentName.pascal}CopilotComponent.tsx Outdated
Comment thread examples/copilot-component-react/src/SampleCopilotComponent.tsx Outdated
Comment thread examples/copilot-component-noframework/src/NoFrameworkCopilotComponent.ts Outdated
Comment thread templates/copilot-component-minimal/src/{componentName.pascal}CopilotComponent.ts Outdated
Comment thread examples/copilot-component-minimal/src/MinimalCopilotComponent.ts Outdated
@svalenciasan

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

@svalenciasan
svalenciasan marked this pull request as draft July 31, 2026 15:18
- Add 'override' keyword to overridden lifecycle hooks (render/onInit/onTeardown)
  across the minimal, noframework, and react copilot components (CLAUDE.md convention)
- react handleResize: compute the next expanded state once and use it for both the
  resize request and setState, avoiding divergence on re-entry
- spfx-cli README: list copilot-component-noframework and copilot-component-react
  in the Copilot Components table
- Regenerate the three examples from the updated templates
Copilot AI review requested due to automatic review settings July 31, 2026 15:23
@svalenciasan

Copy link
Copy Markdown
Author

Thanks for the review! Addressed all comments in 830fa17:

  • override keyword — added override to the overridden lifecycle hooks (render / onInit / onTeardown) across all three components (minimal, noframework, react), per the CLAUDE.md convention. The base BaseCopilotComponent declares these hooks, so the modifier compiles cleanly.
  • handleResize — now computes const nextExpanded = !isExpanded once and uses it for both the resize request and the setIsExpanded call, so the two can't diverge on re-entry.
  • spfx-cli README — the Copilot Components table now lists copilot-component-noframework and copilot-component-react alongside copilot-component-minimal.

Changes were made in the templates (source of truth) and the examples/ were regenerated from them via the CLI. Re-validated: rush build (all copilot examples compile against 1.24.0-beta.2) and heft test --clean (22/22).

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.

Pull request overview

Copilot reviewed 136 out of 160 changed files in this pull request and generated no new comments.

Suppressed comments (4)

templates/copilot-component-noframework/src/{componentName.pascal}CopilotComponent.ts:56

  • The click handler registers an async function (this._handleRequestFullscreen) directly with addEventListener. If requestDisplayModeAsync rejects, this can surface as an unhandled promise rejection. Wrap the call and explicitly handle the rejection (as you already do for the keydown path).
    examples/copilot-component-noframework/src/NoFrameworkCopilotComponent.ts:56
  • The click handler registers an async function (this._handleRequestFullscreen) directly with addEventListener. If requestDisplayModeAsync rejects, this can surface as an unhandled promise rejection. Wrap the call and explicitly handle the rejection (as you already do for the keydown path).
    templates/copilot-component-noframework/src/{componentName.pascal}CopilotComponent.ts:19
  • displayMode falls back to strings.UnknownTheme, which is theme-specific and results in confusing UI (e.g., showing "unknown" for display mode). Use an inline/display-mode-appropriate default instead.

This issue also appears on line 54 of the same file.
examples/copilot-component-noframework/src/NoFrameworkCopilotComponent.ts:19

  • displayMode falls back to strings.UnknownTheme, which is theme-specific and results in confusing UI (e.g., showing "unknown" for display mode). Use an inline/display-mode-appropriate default instead.

This issue also appears on line 54 of the same file.

The host-context 'Mode' badge used Fluent UI v9 color="subtle", which renders
near-invisible low-contrast text in light theme. Switch it to color="important"
(high-contrast and theme-neutral, visible in both light and dark). Pre-existing
issue carried over from the odsp reference; fixed in the new spfx template and
regenerated the example.
Copilot AI review requested due to automatic review settings August 1, 2026 00:31

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.

Pull request overview

Copilot reviewed 136 out of 160 changed files in this pull request and generated no new comments.

Suppressed comments (2)

templates/copilot-component-react/src/{componentName.pascal}CopilotComponent.tsx:33

  • onInit() overrides a base lifecycle hook but does not call super.onInit(). In SPFx components, skipping the base initialization can leave the component/context in a partially initialized state (other templates in this repo call super.onInit() when overriding). Add await super.onInit(); at the top of this override.
    examples/copilot-component-react/src/SampleCopilotComponent.tsx:33
  • onInit() overrides a base lifecycle hook but does not call super.onInit(). In SPFx components, skipping the base initialization can leave the component/context in a partially initialized state (other templates in this repo call super.onInit() when overriding). Add await super.onInit(); at the top of this override.

@svalenciasan
svalenciasan marked this pull request as ready for review August 3, 2026 20:47
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