Skip to content

Conversation

@xenonnn4w
Copy link
Contributor

@xenonnn4w xenonnn4w commented Jan 13, 2026

Purpose / Description/ Approach

This PR adds the foundational infrastructure without changing existing behavior:

  • CardTemplateEditorState: Immutable data class holding UI state (loading, current template ordinal, editor view, errors, messages)
  • CardTemplateEditorViewModel: Manages state via StateFlow with thread-safe updates
  • CardTemplateEditorViewModelTest: Unit tests covering all state operations

This is Part 1 of a multiPR migration:

PR 1 (this): Infrastructure (ViewModel + State) [Done]
PR 2: Wire ViewModel to UI
PR 3: Load notetype + Template manipulation in-memory
PR 4: Atomic save with updateNotetype()
PR 5: Remove legacy code

Links without closing (Part of)

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand what the abstraction will turn out to be.

Mostly seems fine, even if it's just starting to move the screen to a ViewModel

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 16, 2026
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to block forward progress on nitpicks, especially as this change does not affect production functionality.

This should be the last 'change request' before an approve.

Thanks!!!

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great start, thanks!

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Author Reply Waiting for a reply from the original author Needs Review labels Jan 17, 2026
Introduce CardTemplateEditorViewModel and CardTemplateEditorState as
the foundation for migrating CardTemplateEditor to use the Rust
backend's atomic updateNotetype() API.

Part 1 of migration, infrastructure only, no behavioral changes yet.
@david-allison david-allison added the Review High Priority Request for high priority review label Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Card Template Editor Needs Second Approval Has one approval, one more approval to merge Review High Priority Request for high priority review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants