Skip to content

refactor: clean up redundant patterns and reduce duplication#465

Merged
everpcpc merged 1 commit intomainfrom
refactor/cleanup-redundant-patterns
Feb 13, 2026
Merged

refactor: clean up redundant patterns and reduce duplication#465
everpcpc merged 1 commit intomainfrom
refactor/cleanup-redundant-patterns

Conversation

@everpcpc
Copy link
Copy Markdown
Owner

Summary

  • Remove 211 redundant await MainActor.run wrappers across 53 files — SwiftUI Views and @MainActor ViewModels already run on MainActor, making explicit MainActor.run dispatching unnecessary inside Task {} blocks. 32 legitimate usages in actors/non-MainActor classes are preserved.
  • Extract EllipsisMenuButton component to replace the repeated .hidden() + .overlay(Menu { ... }) hack pattern in 4 RowView files
  • Merge duplicate CollectionViewModel/ReadListViewModel into a shared PaginatedIdViewModel that uses closure-based loading, eliminating two nearly identical 83-line files
  • Consolidate 4 glassEffect methods into 2 using a GlassEffectType enum parameter
  • Unify CompositeID usage — replace inline string interpolation with CompositeID.generate() in 2 store files
  • Cache DateFormatter instances with static let in Date+Formatting to avoid per-call allocation
  • Clean up dead code — remove empty prepareChapter stub, commented-out code, fix wrong file header

Net: 67 files changed, -506 lines

Test plan

  • iOS build passes (make build-ios)
  • macOS build passes (make build-macos)
  • Manual test: browse collections and read lists (verifies PaginatedIdViewModel)
  • Manual test: context menus on row views (verifies EllipsisMenuButton)
  • Manual test: reader open/close (verifies MainActor.run removal)
  • Manual test: cache clearing in settings (verifies MainActor.run removal)

🤖 Generated with Claude Code

- Remove 211 redundant `await MainActor.run` wrappers from 53 View/ViewModel
  files (SwiftUI Views and @mainactor classes already run on MainActor)
- Extract EllipsisMenuButton component to replace repeated .hidden()+.overlay()
  hack across 4 RowView files
- Merge duplicate CollectionViewModel/ReadListViewModel into shared
  PaginatedIdViewModel with closure-based loading
- Consolidate 4 glassEffect methods into 2 via GlassEffectType enum
- Use CompositeID.generate() consistently in KomgaCollectionStore and
  KomgaReadListStore instead of inline string interpolation
- Cache DateFormatter instances with static let in Date+Formatting
- Remove dead prepareChapter stub in EpubReaderViewModel
- Remove commented-out code in Double+FileSize
- Fix wrong file header in View+PickerStyle.swift

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@everpcpc everpcpc merged commit d946cd0 into main Feb 13, 2026
3 checks passed
@everpcpc everpcpc deleted the refactor/cleanup-redundant-patterns branch February 13, 2026 12:36
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.

1 participant