ankidroid / ankidroid/Anki-Android

Migrate Card Template Editor to Rust backend for atomic notetype updates

未关闭
#19,956 9 条评论 0 个 reaction 已指派 1 人 已被 @xenonnn4w 认领 在 GitHub 查看
Anki Ecosystem Compatibility
主要语言
Kotlin
星标
11.8k
派生
2.9k
平均合并
2 天 3 小时
30 天内合并 PR
171

描述

Migrate the Card Template Editor to use the Rust backend's atomic `updateNotetype()` API instead of the current legacy approach that uses individual `addTemplate()` / `removeTemplate()` / `updateDict()` calls.

The current implementation has an atomicity issue where templates can be persisted to the database even if the final save fails (here)
https://github.com/ankidroid/Anki-Android/blob/0f4f87e486c56236087fbcec37c8929173e67989/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateNotetype.kt#L122-L141
This can cause data corruption with duplicate card types (e.g., "Card 2+", "Card 3++") if the user adds templates, encounters a validation error, and discards changes.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。