Skip to content

Conversation

@jcampuza
Copy link
Owner

@jcampuza jcampuza commented Jan 8, 2026

Summary

  • Create DictionaryViewModel with @Observable pattern following Store → ViewModel → UI architecture
  • Centralized performAction error handler for async operations with automatic error display
  • Update DictionaryView to use ViewModel with State(initialValue:) init pattern to avoid view flicker
  • Add 18 comprehensive unit tests for DictionaryViewModelTests

Changes

DictionaryViewModel (TalkFlow/Features/Dictionary/DictionaryViewModel.swift):

  • Computed properties: filteredTerms, isEmpty, hasNoSearchResults, isAtLimit, termCountLabel
  • Actions: addTerm, updateTerm, toggleTerm, deleteTerm, clearSearch, dismissError
  • Error state management with showingError and errorMessage

DictionaryView (TalkFlow/UI/Dictionary/DictionaryView.swift):

  • Uses State(initialValue:) pattern in init to avoid ViewModel flicker
  • All state and actions delegate to the ViewModel
  • Simplified from 214 lines to 165 lines

Test plan

  • All 57 existing tests pass
  • 18 new DictionaryViewModel tests cover:
    • Computed properties (isEmpty, filteredTerms, hasNoSearchResults, isAtLimit, termCountLabel)
    • Actions (addTerm, updateTerm, toggleTerm, deleteTerm, clearSearch, dismissError)
    • Error handling scenarios

🤖 Generated with Claude Code

jcampuza and others added 2 commits January 7, 2026 19:31
- Add database migration to clean up empty transcription records
- Prevent saving empty/whitespace-only transcriptions in HistoryStorage
- Add instant recording mode (0ms hold duration option)
- Fix Keychain permission dialog appearing on app launch by using
  hasAPIKeyWithoutFetch() to check for stored keys without retrieving
- Improve indicator state handling with isTransient check
- Increase minimum window size to 900x600
- Add accent color tint to Toggle controls
- Add tests for empty record skipping behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create DictionaryViewModel with @observable pattern
- Centralized performAction error handler for async operations
- Computed properties: filteredTerms, isEmpty, hasNoSearchResults, isAtLimit, termCountLabel
- Actions: addTerm, updateTerm, toggleTerm, deleteTerm, clearSearch, dismissError
- Update DictionaryView to use ViewModel with State(initialValue:) init pattern
- Add 18 comprehensive tests for DictionaryViewModelTests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jcampuza jcampuza merged commit df2e624 into main Jan 8, 2026
1 check passed
@jcampuza jcampuza deleted the feature/viewmodel-pattern branch January 8, 2026 15:14
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.

2 participants