Skip to content

Conversation

@OS-paulvisciano
Copy link
Contributor

@OS-paulvisciano OS-paulvisciano commented Jan 15, 2026

Exposing ReactiveController and Host publicly to make it easier to implement the pattern and also provide a common interface community members can use to create and share Controllers

What is the current behavior?

The classes were internal to the tests

What is the new behavior?

Exposed as part of the public API

Documentation

For more info on Reactive Controllers

https://stenciljs.com/docs/extends

Does this introduce a breaking change?

  • Yes
  • No

Testing

Existing tests using the Reactive controller pattern now import the implementation from core and pass.

…community as a pattern for creating & sharing controllers
@OS-paulvisciano OS-paulvisciano requested a review from a team as a code owner January 15, 2026 09:00
Copilot AI review requested due to automatic review settings January 15, 2026 09:00
Copy link
Contributor

Copilot AI left a comment

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 moves the ReactiveController interface and ReactiveControllerHost class from internal test files into the public Stencil Core API. This enables developers to use the reactive controller pattern for component composition, similar to patterns found in frameworks like Lit.

Changes:

  • Moved ReactiveController and ReactiveControllerHost from test-local implementations to src/runtime/reactive-controller.ts as public exports
  • Updated all test files to import from @stencil/core instead of local ./reactive-controller-host.js files
  • Added proper TypeScript type declarations in stencil-public-runtime.ts

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/runtime/reactive-controller.ts Implements the ReactiveController interface and ReactiveControllerHost class with lifecycle hooks
src/runtime/index.ts Exports ReactiveController and ReactiveControllerHost from the runtime module
src/declarations/stencil-public-runtime.ts Adds public TypeScript type declarations for the reactive controller API
src/internal/stencil-core/index.d.ts Exports the new public types and classes in the main API surface
src/compiler/transformers/update-stencil-core-import.ts Adds ReactiveController and ReactiveControllerHost to KEEP_IMPORTS list
src/hydrate/platform/index.ts Re-exports the new API for server-side rendering support
test/wdio/ts-target/extends-composition-scaling/reactive-controller-host.ts Deleted - local implementation replaced by public API
test/wdio/ts-target/extends-via-host/mouse-controller.ts Updated import to use @stencil/core
test/wdio/ts-target/extends-via-host/cmp.tsx Updated import to use @stencil/core
test/wdio/ts-target/extends-composition-scaling/validation-controller.ts Updated import to use @stencil/core
test/wdio/ts-target/extends-composition-scaling/text-input-cmp.tsx Updated import to use @stencil/core
test/wdio/ts-target/extends-composition-scaling/radio-group-cmp.tsx Updated import to use @stencil/core
test/wdio/ts-target/extends-composition-scaling/focus-controller.ts Updated import to use @stencil/core
test/wdio/ts-target/extends-composition-scaling/checkbox-group-cmp.tsx Updated import to use @stencil/core
Comments suppressed due to low confidence (1)

src/runtime/reactive-controller.ts:62

  • Extra blank line at end of file should be removed.

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

Comment on lines +668 to +672
componentWillLoad(): Promise<void> | void;
componentDidLoad(): void;
componentWillRender(): Promise<void> | void;
componentDidRender(): void;
componentWillUpdate(): Promise<void> | void;
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The type declaration shows componentWillLoad() returns Promise<void> | void, but the actual implementation in src/runtime/reactive-controller.ts (line 38-40) doesn't return anything and only calls controller hooks. The declaration should match the implementation's return type or the implementation should properly handle async controller hooks.

Suggested change
componentWillLoad(): Promise<void> | void;
componentDidLoad(): void;
componentWillRender(): Promise<void> | void;
componentDidRender(): void;
componentWillUpdate(): Promise<void> | void;
componentWillLoad(): void;
componentDidLoad(): void;
componentWillRender(): void;
componentDidRender(): void;
componentWillUpdate(): void;

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@OS-paulvisciano can you please check this out ☝🏻

@gnbm gnbm requested review from gnbm and johnjenkins January 15, 2026 15:42
Copy link
Contributor

@gnbm gnbm left a comment

Choose a reason for hiding this comment

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

@OS-paulvisciano Two checks are failing:

And ideally it would be good practice to use signed commits

'jsx',
'jsxs',
'jsxDEV',
'ReactiveController',
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this list are imports that actively have a runtime component - ReactiveController is an interface only(?) so shouldn't be here

postUpdateComponent,
proxyComponent,
proxyCustomElement,
ReactiveController,
Copy link
Contributor

Choose a reason for hiding this comment

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

again - I don't think an interface should be in this list

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