Skip to content

[LWD] feat: add ability to reset mock stock accounts#18719

Open
claudiiafg wants to merge 1 commit into
developfrom
feat/lwd-reset-mock-stock-accounts
Open

[LWD] feat: add ability to reset mock stock accounts#18719
claudiiafg wants to merge 1 commit into
developfrom
feat/lwd-reset-mock-stock-accounts

Conversation

@claudiiafg

@claudiiafg claudiiafg commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

📝 Description

This pull request adds a new "Reset stocks" feature to the developer mock-accounts tooling in Ledger Live Desktop. This allows developers to easily remove all stock token sub-accounts from their portfolio without affecting other holdings. The implementation includes UI changes, supporting logic, and related tests.

Feature: Reset stocks button in developer tooling

  • Added a "Reset stocks" button to the mock-accounts developer section, enabling removal of all stock token sub-accounts while preserving other accounts. The button is conditionally enabled and provides user feedback if no stock accounts are present.

Supporting logic and utilities

  • Implemented countStockTokenAccounts and removeStockAccounts utility functions to count and remove stock token accounts, respectively, ensuring accurate state updates and handling edge cases (such as empty portfolios).
  • Added unit tests for countStockTokenAccounts to verify correct behavior.
Screenshot 2026-06-18 at 13 25 55

❓ Context



🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@claudiiafg claudiiafg self-assigned this Jun 18, 2026
@live-github-bot live-github-bot Bot added desktop Has changes in LLD translations Translation files have been touched labels Jun 18, 2026
@live-github-bot live-github-bot Bot changed the title feat: add ability to reset mock stock accounts [LWD] feat: add ability to reset mock stock accounts Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ⏭️ Skipped
Native Storybook Build ⏭️ Skipped
React Storybook Build ⏭️ Skipped

@claudiiafg claudiiafg force-pushed the feat/lwd-reset-mock-stock-accounts branch from 25e22cf to 8a1dabf Compare June 18, 2026 12:26
@claudiiafg claudiiafg marked this pull request as ready for review June 18, 2026 12:27
@claudiiafg claudiiafg requested a review from a team as a code owner June 18, 2026 12:27
Copilot AI review requested due to automatic review settings June 18, 2026 12:27

Copilot AI 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.

Pull request overview

This PR adds a “Reset stocks” action to Ledger Live Desktop’s developer mock-accounts tooling, intended to remove stock token sub-accounts from the portfolio while keeping other holdings intact.

Changes:

  • Added new i18n strings for “Reset stocks” and associated confirmation/empty-state alerts.
  • Introduced utilities to count and remove stock token accounts, and wired a new reset button into the developer settings UI.
  • Added a unit test for stock token account counting, plus a changeset for the desktop app.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/ledger-live-desktop/static/i18n/en/app.json Adds UI strings for the new reset-stocks action and alerts.
apps/ledger-live-desktop/src/renderer/screens/settings/sections/Developer/GenerateMockAccounts/utils.ts Adds stock-token account counting/removal logic used by the reset feature.
apps/ledger-live-desktop/src/renderer/screens/settings/sections/Developer/GenerateMockAccounts/StocksMockAccountGenerator.tsx Adds the “Reset stocks” button and hooks it up to the new utilities.
apps/ledger-live-desktop/src/renderer/screens/settings/sections/Developer/GenerateMockAccounts/tests/utils.stockAccounts.test.ts Adds unit coverage for counting stock token accounts.
.changeset/lwd-reset-mock-stock-accounts.md Declares a patch release for ledger-live-desktop.

Comment on lines +199 to +205
export async function removeStockAccounts(stockTokenIds: Set<string>): Promise<number> {
if (stockTokenIds.size === 0) return 0;

const accountData = await getKey("app", "accounts", []);
let removedCount = 0;

const updated = (accountData ?? []).reduce<[Account, AccountUserData][]>((next, entry) => {
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 7 projects with changes.

📊 Quick Summary
Project Total Size Change
desktop-main 2.6 MB -
desktop-preloader 7.1 KB -
desktop-renderer 81.2 MB -
desktop-webviewDappPreloader 36.9 KB -
desktop-webviewPreloader 0 B -
desktop-workers 36.8 KB -
mobile 257.0 MB -
📋 Detailed Reports (Click to expand)

📁 desktop-main

Path: rsdoctor/desktop-main/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.6 MB - -
📄 JavaScript 2.4 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 135.3 KB - -

📁 desktop-preloader

Path: rsdoctor/desktop-preloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 7.1 KB - -
📄 JavaScript 5.3 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 1.8 KB - -

📁 desktop-renderer

Path: rsdoctor/desktop-renderer/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 81.2 MB - -
📄 JavaScript 28.9 MB - -
🎨 CSS 171.9 KB - -
🌐 HTML 1.8 KB - -
📁 Other Assets 52.2 MB - -

📁 desktop-webviewDappPreloader

Path: rsdoctor/desktop-webviewDappPreloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 36.9 KB - -
📄 JavaScript 36.9 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 desktop-webviewPreloader

Path: rsdoctor/desktop-webviewPreloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 0 B - -
📄 JavaScript 0 B - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 desktop-workers

Path: rsdoctor/desktop-workers/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 36.8 KB - -
📄 JavaScript 36.8 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 mobile

Path: rsdoctor/mobile/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 257.0 MB - -
📄 JavaScript 107.9 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 149.1 MB - -

Generated by Rsdoctor GitHub Action

@claudiiafg claudiiafg force-pushed the feat/lwd-reset-mock-stock-accounts branch from 8a1dabf to 49a93ec Compare June 18, 2026 13:18
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

🖥️ Desktop

-> Run Desktop E2E

  • Select "Run workflow"
  • Branch: feat/lwd-reset-mock-stock-accounts
  • Device: nanoSP or stax

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
50.7% Coverage on New Code (required ≥ 80%)
4 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Has changes in LLD translations Translation files have been touched

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants