Skip to content

Deprecate BaseControllerV1 and use BaseControllerV2 as default#2078

Merged
mcmire merged 10 commits intomainfrom
231121-deprecate-base-controller-v1
Nov 22, 2023
Merged

Deprecate BaseControllerV1 and use BaseControllerV2 as default#2078
mcmire merged 10 commits intomainfrom
231121-deprecate-base-controller-v1

Conversation

@MajorLift
Copy link
Copy Markdown
Contributor

@MajorLift MajorLift commented Nov 21, 2023

Motivation

The controller-messenger pattern implemented by BaseControllerV2 is intended to be used by all of our controllers. Currently, the default BaseController name points to the older base controller implementation, which needs to be deprecated and only used for temporary backwards compatibility while all controllers are brought up-to-date.

Explanation

In this commit, we export BaseControllerV2 as the default BaseController, and add a @deprecated tsdoc tag to the old BaseController class as well as export it under the new name BaseControllerV1 to discourage future usage.

This aligns with the PollingController naming scheme, where the up-to-date version is the default, and outdated mixins are named with qualifiers (PollingControllerOnly, PollingControllerV1).

Impact

Existing controller classes in core that extend from the old base controller are not affected — they now simply extend from BaseControllerV1 instead of BaseController.

External packages will need to update any instances of extends BaseController to extends BaseControllerV1 and extends BaseControllerV2 to extends BaseController, along with accompanying changes to import statements.

References

Changelog

@metamask/base-controller

Changed

  • BREAKING: The default BaseController export now points to the up-to-date implementation that was formerly named BaseControllerV2.
  • BREAKING: The old BaseController class is marked as deprecated with the @deprecated tsdoc tag and exported under the name BaseControllerV1.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@MajorLift MajorLift requested review from a team as code owners November 21, 2023 23:08
@MajorLift MajorLift self-assigned this Nov 21, 2023
@MajorLift MajorLift added the team-wallet-framework Deprecated: Please use `team-core-platform` instead. label Nov 21, 2023
@MajorLift MajorLift force-pushed the 231121-deprecate-base-controller-v1 branch from d58f9a1 to bd3e200 Compare November 21, 2023 23:13
@MajorLift MajorLift force-pushed the 231121-deprecate-base-controller-v1 branch from bd3e200 to 253872a Compare November 21, 2023 23:14
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Had a couple of comments.

export type { BaseConfig, BaseState, Listener } from './BaseController';
export { BaseController } from './BaseController';
export type { BaseConfig, BaseState, Listener } from './BaseControllerV1';
export { BaseController as BaseControllerV1 } from './BaseControllerV1';
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.

What do you think about renaming BaseController to BaseControllerV1 in BaseControllerV1.ts? That way it matches the file name and we don't have to alias it here.

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.

We can definitely do that. Applied here: 42a87e7

@mcmire mcmire mentioned this pull request Nov 21, 2023
@mcmire mcmire merged commit be55ceb into main Nov 22, 2023
@mcmire mcmire deleted the 231121-deprecate-base-controller-v1 branch November 22, 2023 14:54
mcmire added a commit that referenced this pull request Nov 22, 2023
…2078)

## Motivation

The controller-messenger pattern implemented by `BaseControllerV2` is
intended to be used by all of our controllers. Currently, the default
`BaseController` name points to the older base controller
implementation, which needs to be deprecated and only used for temporary
backwards compatibility while all controllers are brought up-to-date.

## Explanation

In this commit, we export `BaseControllerV2` as the default
`BaseController`, and add a `@deprecated` tsdoc tag to the old
`BaseController` class as well as export it under the new name
`BaseControllerV1` to discourage future usage.

This aligns with the `PollingController` naming scheme, where the
up-to-date version is the default, and outdated mixins are named with
qualifiers (`PollingControllerOnly`, `PollingControllerV1`).

## Impact

Existing controller classes in core that extend from the old base
controller are not affected — they now simply extend from
`BaseControllerV1` instead of `BaseController`.

External packages will need to update any instances of `extends
BaseController` to `extends BaseControllerV1` and `extends
BaseControllerV2` to `extends BaseController`, along with accompanying
changes to import statements.

---------

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-wallet-framework Deprecated: Please use `team-core-platform` instead.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a deprecated directive for BaseController V1

3 participants