Back to all reviewers

Limit plugin outlet APIs

discourse/discourse
Based on 2 comments
Other

When creating plugin outlets or extension points, avoid exposing entire component instances, controllers, or large objects. Instead, pass explicit, minimal arguments that represent only the data and actions that plugins actually need.

API Other

Reviewer Prompt

When creating plugin outlets or extension points, avoid exposing entire component instances, controllers, or large objects. Instead, pass explicit, minimal arguments that represent only the data and actions that plugins actually need.

Exposing entire objects makes them part of the public API, making future refactoring difficult and creating tight coupling between internal implementation and external consumers.

Bad:

<PluginOutlet
  @name="sub-category-item"
  @outletArgs=
/>

<PluginOutlet
  @name="exception-wrapper"
  @outletArgs=
/>

Good:

<PluginOutlet
  @name="sub-category-item"
  @outletArgs=
/>

<PluginOutlet
  @name="exception-wrapper"
  @outletArgs=
/>

This approach creates stable, documented interfaces that can evolve independently of internal implementation changes.

2
Comments Analyzed
Other
Primary Language
API
Category

Source Discussions