Skip to content

fix(app): dedupe custom vocabulary words within a single batch add - #23061

Merged
kodjima33 merged 1 commit into
mainfrom
issues-improver/22793-dedupe-vocabulary-batch
Oct 21, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
issues-improver/22793-dedupe-vocabulary-batch

Conversation

@kodjima33

@kodjima33 kodjima33 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

What

UserProvider.addVocabularyWords (app/lib/providers/user_provider.dart) only deduped a
batch add against the already-saved vocabulary (_transcriptionVocabulary), not against
other words in the same batch, and never dropped blank entries. Typing omi, omi in
Settings → Custom Vocabulary saved two identical omi entries; removeVocabularyWord
then removed every entry equal to the tapped word, so the single "x" on one duplicate chip
deleted both.

Why

Fixes #22793.

Fix

addVocabularyWords now tracks a seen set across the whole batch (seeded with the
existing vocabulary) and skips blank/duplicate entries before appending, so a batch add
saves each distinct word once. No change to removeVocabularyWord: once duplicates can no
longer be saved, removing a word no longer has more than one matching entry to remove.

Tested

Added two regression tests to app/test/providers/user_provider_vocabulary_test.dart
reproducing the issue's exact repro (['omi', 'omi', '', 'alpha'] and an all-duplicate
batch). Confirmed both new tests fail against unmodified user_provider.dart with the
exact reported symptom (['alpha', 'omi', 'omi', ''] saved) and pass with the fix.
Full flutter test test/providers/user_provider_vocabulary_test.dart test/pages/settings/custom_vocabulary_page_test.dart test/pages/settings/custom_vocabulary_deletion_test.dart — 12/12 pass, no regressions in
the surrounding feature.

UI-Evidence: none -- pure provider logic change (list dedup in addVocabularyWords), no widget/rendering change

Product invariants affected

none

Failure class (fixes)

Failure-Class: none

Narrow input-dedup bug in one provider method, not a recurring semantic class.

Auto-generated from issue feedback by the mini issues-improver — tested and merged.

View guided diff Turn on auto-fix

addVocabularyWords only deduped against the already-saved vocabulary, not
against other words in the same batch, and kept blank entries. Typing
'omi, omi' saved two identical chips, and removeVocabularyWord then
deleted every entry equal to the tapped word on one x tap.

fixes #22793
@kodjima33
kodjima33 merged commit 15182a9 into main Oct 21, 2026
49 checks passed
@kodjima33
kodjima33 deleted the issues-improver/22793-dedupe-vocabulary-batch branch October 21, 2026 15:39
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.

Typing a custom vocabulary word twice saves it twice, and one x removes both

1 participant