Files
PalladiumWallet/docs/adr/0020-single-viewmodel-with-feature-partials.md
T
davide b292590cdc docs: add docs-as-code process and one ADR per feature
docs/docs-as-code.md defines the workflow; docs/adr holds 31 ADRs
(retroactive, reconstructed from code and changelog) with a template and
index. docs/check-docs.sh validates ADR structure, index, cited code
paths, relative links and CLAUDE.md/AGENTS.md sync.
2026-11-03 09:45:51 +01:00

26 lines
1.0 KiB
Markdown

# 0020. A single ViewModel split into partial classes by feature
- **Status:** Accepted
- **Area:** UI
- **Recorded:** 2026-11-03 (retroactive: reconstructed from code, comments and changelog)
## Context
The UI is one `MainView` with many overlays sharing wallet, sync and connection state; many small ViewModels would need heavy cross-wiring.
## Decision
Use one `MainWindowViewModel` (CommunityToolkit.Mvvm: `[ObservableProperty]`, `[RelayCommand]`) that drives `Core` directly, split into partial classes by feature (`.Send`, `.Receive`, `.Sync`, `.Settings`, `.Wizard`, `.Contacts`, `.Update`, `.WalletInfo`, `.Donate`). New feature logic goes into the matching partial or a new one.
## Consequences
- Shared state needs no messaging layer.
- The class is large; discipline on partial boundaries is what keeps it navigable.
- Heavy network work must run off the UI thread (`Task.Run`).
## References
- `src/App/ViewModels/MainWindowViewModel.cs`
- `src/App/ViewModels/MainWindowViewModel.Send.cs`
- `src/App/ViewModels/MainWindowViewModel.Sync.cs`