Skip to content

fix: reduce CPU usage on Manage page (#1998)#2058

Open
gauravsaini wants to merge 1 commit intoubuntu:mainfrom
gauravsaini:fix/manage-cpu-usage-1998
Open

fix: reduce CPU usage on Manage page (#1998)#2058
gauravsaini wants to merge 1 commit intoubuntu:mainfrom
gauravsaini:fix/manage-cpu-usage-1998

Conversation

@gauravsaini
Copy link
Copy Markdown

Summary

Root Cause

The ManageAppActions widget called ref.watch(snapModelProvider(snap.name)) for every snap tile, creating a full SnapModel for each installed snap. With 100+ snaps, this caused significant overhead as each SnapModel independently fetches data from snapd.

Fix

Refactored _buildSnapActions to avoid creating per-snap SnapModel instances on each tile:

  1. Display decisions use Snap data directly - refreshInhibit, apps.isNotEmpty, updateVersion are available from ManageSnapData.snap without needing a full SnapModel

  2. Active changes tracked at manage page level - Uses currentlyInstallingModelProvider instead of per-snap SnapModel.activeChangeId

  3. Lazy SnapModel creation - Only creates/reads snapModelProvider when an action button (update, open, remove) is actually pressed

  4. Simplified launchability check - Uses snap.apps.isNotEmpty instead of LaunchProvider

Testing

Verify that:

  • Manage page loads quickly with 100+ installed snaps
  • Update, Open, and Remove buttons still work correctly
  • Active change status still shows when a snap operation is in progress

…buntu#1998)

The ManageAppActions widget was creating a full SnapModel for every
installed snap tile, causing high CPU usage with 100+ snaps. Each
SnapModel independently fetches data from snapd.

This fix:
- Uses Snap data from ManageSnapData directly for display decisions
- Checks currentlyInstallingModelProvider for active changes instead
  of per-snap SnapModel
- Only creates/reads SnapModel when an action button is actually pressed
- Uses snap.apps.isNotEmpty for launchability instead of LaunchProvider
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.

High CPU usage on "Manage" screen

1 participant