refactor: clean up redundant patterns and reduce duplication#465
Merged
refactor: clean up redundant patterns and reduce duplication#465
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
await MainActor.runwrappers across 53 files — SwiftUI Views and@MainActorViewModels already run on MainActor, making explicitMainActor.rundispatching unnecessary insideTask {}blocks. 32 legitimate usages in actors/non-MainActor classes are preserved.EllipsisMenuButtoncomponent to replace the repeated.hidden()+.overlay(Menu { ... })hack pattern in 4 RowView filesCollectionViewModel/ReadListViewModelinto a sharedPaginatedIdViewModelthat uses closure-based loading, eliminating two nearly identical 83-line filesglassEffectmethods into 2 using aGlassEffectTypeenum parameterCompositeIDusage — replace inline string interpolation withCompositeID.generate()in 2 store filesDateFormatterinstances withstatic letinDate+Formattingto avoid per-call allocationprepareChapterstub, commented-out code, fix wrong file headerNet: 67 files changed, -506 lines
Test plan
make build-ios)make build-macos)🤖 Generated with Claude Code