Skip to content

feat(profile-controller): add clearState method - #11177

Merged
hmalik88 merged 9 commits into
mainfrom
hm/add-clear-state
Oct 29, 2026
Merged

hmalik88 merged 9 commits into
mainfrom
hm/add-clear-state

Conversation

@hmalik88

@hmalik88 hmalik88 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Added clear state method.

References

N/A

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 communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Clearing persisted profile state locally can desync UI from server-side data if misused at logout or account switch; callers must coordinate with auth/session flows.

Overview
Adds a clearState API on ProfileController so callers can wipe local profile state (MetaMask profile fields back to defaults and xProfile removed) without calling the profile API—unlike deleteProfile, which deletes remotely and then resets state.

The method is registered on the messenger as ProfileController:clearState, with the corresponding action type exported from the package. Tests assert default state, undefined getProfile / getXProfile, and a single stateChanged emission.

Reviewed by Cursor Bugbot for commit c0072c7. Bugbot is set up for automated code reviews on this repo. Configure here.

@hmalik88
hmalik88 marked this pull request as ready for review October 28, 2026 22:13
@hmalik88
hmalik88 requested review from a team as code owners October 28, 2026 22:13

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d1b4a26. Configure here.

@hmalik88
hmalik88 added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 5acb2f9 Oct 29, 2026
46 checks passed
@hmalik88
hmalik88 deleted the hm/add-clear-state branch October 29, 2026 00:56
@montelaidev montelaidev mentioned this pull request Oct 29, 2026
1 of 4 tasks
@Prithpal-Sooriya Prithpal-Sooriya mentioned this pull request Oct 29, 2026
1 task done
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Re-lands the release that was reverted in MetaMask#11187 (the revert happened
because CI on main was broken; the CI issue has since been fixed via
MetaMask#11191, and Release/1375.0.0 was subsequently shipped by another team in
MetaMask#11192, so this release is now **Release/1376.0.0**).

To avoid cutting two separate releases, this PR also folds in the
`@metamask/profile-controller` patch release that was staged in MetaMask#11197
(that PR is now redundant and closed in favor of this one).

Two packages are released:

**`@metamask/assets-controller` 20.0.2 (patch)** — 20.0.2 was never
published to npm, so this re-release is safe.

- **Fixed:** hand-rolled Multicall3 `aggregate3` codecs for balance
batches (MetaMask#11078)

**`@metamask/profile-controller` 1.2.1 (patch)**

- **Added:** `clearState` method on `ProfileController` (MetaMask#11177)
- **Changed:** bump `@metamask/utils` from `^12.0.0` to `^12.0.1`
(MetaMask#11107)
- **Fixed:** `ProfileService.disconnectX` now calls `DELETE
profiles/x/account` instead of the non-existent `DELETE
profiles/{profileId}/x` endpoint, since the linked X account is resolved
server-side from the verified bearer token (MetaMask#11195)

All functional changes above are already merged on `main`; this diff
contains only version bumps and changelog finalization (plus a merge of
`main` to pick up MetaMask#11195).

- `@metamask/bridge-controller` and
`@metamask/transaction-pay-controller` only have their
`@metamask/assets-controller` dependency range bumped to `^20.0.2`; they
are intentionally not released.

## Checklist

- [x] `yarn changelog:validate` passes
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.

2 participants