Skip to content

Commit f021d84

Browse files
committed
refactor(desktop): move Settings → Usage into a features/usage slice
Extract the Usage settings surface out of the frozen legacy renderer zone into a feature slice `src/renderer/features/usage/` (ports + services-context + ui), so net-new Usage work (the #2015/#4164 pricing tab) is no longer blocked by the tooltip and the read-only pricing tab). - `features/usage/` owns the surface: narrow `UsageServices` ports (`loadUsageStats`, `updateUsageSettings` — `UsageSettings` in and out, never the whole `AppSettings`); a persistent `UsageFeatureScope` holding the single tagged `{ range, value }` snapshot + reload ticket + Host-generation invalidation + load-failure toast; and a disposable `UsageSettingsView`. - `settings/usage-settings-page.tsx` is a thin legacy shim (`UsageScopeMount` + `UsageSettingsPage`). `settings-surface.tsx` mounts the scope ABOVE its loading/error gate and passes a `host:epoch` `targetKey` as a prop; the scope clears and fences in place on a target change (no React `key`). The Host-change handler also calls the scope's imperative `fenceTarget()` synchronously, so an in-flight old-Host load cannot land in the window before the re-render. - Regenerate renderer-architecture.json and the astryx surface inventory. Extraction-only; the Desktop adapter/composition wiring and the editable pricing tab remain follow-ups. Refs #4425. Generated-by: Claude Code
1 parent ad18da4 commit f021d84

15 files changed

Lines changed: 1880 additions & 721 deletions

apps/desktop/renderer-architecture.json

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
"src/renderer/settings/runtime-host-ssh-terminal-dialog.tsx",
182182
"src/renderer/settings/settings-error-copy.ts",
183183
"src/renderer/settings/settings-expandable-row.tsx",
184-
"src/renderer/settings/settings-metric-card.tsx",
185184
"src/renderer/settings/settings-modal.tsx",
186185
"src/renderer/settings/settings-nav.ts",
187186
"src/renderer/settings/settings-request-authority.ts",
@@ -3891,17 +3890,6 @@
38913890
"react": 1
38923891
}
38933892
},
3894-
"src/renderer/settings/settings-metric-card.tsx": {
3895-
"bridgePaths": {},
3896-
"environmentCapabilities": {},
3897-
"hookCalls": {},
3898-
"lifecycleMethods": {},
3899-
"unresolvedDependencies": 0,
3900-
"actionFactories": [],
3901-
"dependencyPaths": {
3902-
"@maka/ui": 1
3903-
}
3904-
},
39053893
"src/renderer/settings/settings-modal.tsx": {
39063894
"bridgePaths": {},
39073895
"environmentCapabilities": {},
@@ -4085,11 +4073,11 @@
40854073
"window.removeEventListener": 1
40864074
},
40874075
"hookCalls": {
4088-
"useEffect": 10,
4076+
"useEffect": 9,
40894077
"useMediaQuery": 1,
40904078
"useMountedRef": 1,
4091-
"useRef": 10,
4092-
"useState": 12,
4079+
"useRef": 8,
4080+
"useState": 11,
40934081
"useToast": 1,
40944082
"useUiLocale": 2
40954083
},
@@ -4247,29 +4235,17 @@
42474235
"bridgePaths": {},
42484236
"environmentCapabilities": {},
42494237
"hookCalls": {
4250-
"useActionGuard": 1,
4251-
"useOptimisticSettingsDraft": 1,
4252-
"useState": 1,
4253-
"useToast": 1,
42544238
"useUiLocale": 1
42554239
},
42564240
"lifecycleMethods": {},
42574241
"unresolvedDependencies": 0,
42584242
"actionFactories": [],
42594243
"dependencyPaths": {
4260-
"../../shared/runtime-host-identity.js": 1,
4261-
"../locales/settings-usage-copy": 1,
4244+
"../features/usage": 2,
42624245
"./settings-error-copy": 1,
4263-
"./settings-metric-card": 1,
42644246
"./settings-section": 1,
4265-
"./use-action-guard": 1,
4266-
"./use-optimistic-settings-draft": 1,
4267-
"@astryxdesign/core": 1,
42684247
"@maka/core/settings": 1,
4269-
"@maka/core/ui-locale": 1,
4270-
"@maka/core/usage-ledger-merge": 1,
42714248
"@maka/ui": 1,
4272-
"@maka/ui/icons": 1,
42734249
"react": 1
42744250
}
42754251
},

0 commit comments

Comments
 (0)