Skip to content

fix(wallet): fall back to options.analyticsId when persisted id is empty - #11025

Merged
gauthierpetetin merged 4 commits into
mainfrom
fix/wallet-analytics-id-null-override
Oct 23, 2026
Merged

gauthierpetetin merged 4 commits into
mainfrom
fix/wallet-analytics-id-null-override

Conversation

@gauthierpetetin

@gauthierpetetin gauthierpetetin commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

AnalyticsController init merged state as { analyticsId: options.analyticsId, ...state }, so a persisted analyticsId: null (common in first-run / extension fixtures) overwrote the client-supplied UUID and crashed with Invalid analyticsId.

This change prefers a non-empty persisted analyticsId, and otherwise uses options.analyticsId.

References

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

Low Risk
Targeted analytics init bugfix with no auth or payment impact; behavior change only when persisted analytics id is empty.

Overview
Fixes wallet AnalyticsController initialization so first-run or fixture persisted state with analyticsId set to null, undefined, or '' no longer overwrites the client-supplied UUID and triggers Invalid analyticsId.

Init now resolves the id explicitly: only a non-empty persisted string wins; otherwise it uses options.analyticsId. Tests cover the empty persisted cases, and changelog/JSDoc describe the new override rules.

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

Null, undefined, or empty persisted analyticsId must not overwrite the
client-supplied option, or first-run / fixture state crashes wallet init.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gauthierpetetin
gauthierpetetin requested a review from a team as a code owner October 23, 2026 06:19
Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Current version of PR was reviewed by /review-bugbot on Oct 23, 08:12 GMT+2. It flagged 0 findings.

Bugbot on commit 3cbc492 is skipped.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
@gauthierpetetin
gauthierpetetin added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit af0b3a5 Oct 23, 2026
46 checks passed
@gauthierpetetin
gauthierpetetin deleted the fix/wallet-analytics-id-null-override branch October 23, 2026 12:53
@gauthierpetetin gauthierpetetin mentioned this pull request Oct 23, 2026
1 of 4 tasks
SnowingFox pushed a commit to SnowingFox/core-1 that referenced this pull request Oct 24, 2026
## Explanation

Minor release of `@metamask/wallet` (`19.0.0` → `19.1.0`).

- Add support for Node.js 26.
([MetaMask#10981](MetaMask#10981))
- Fall back to `options.analyticsId` when persisted `analyticsId` is
null, undefined, or empty.
([MetaMask#11025](MetaMask#11025))

## References

- [MetaMask#10981](MetaMask#10981)
- [MetaMask#11025](MetaMask#11025)

## 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
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only release; included analytics ID fallback is
a narrow initialization fix and Node 26 is an engines declaration
update.
> 
> **Overview**
> **Release monorepo `1360.0.0` and publish `@metamask/wallet`
`19.1.0`.** The diff is version bumps in the root `package.json` and
`packages/wallet/package.json`, plus changelog housekeeping for the
wallet package.
> 
> The **19.1.0** notes (moved out of `[Unreleased]`) cover two
already-merged changes: **Node.js 26** support in the package engines
matrix, and a fix so wallet `AnalyticsController` initialization uses
**`options.analyticsId`** when persisted state has a null, undefined, or
empty `analyticsId` (non-empty persisted values still win).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8d14cef. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants