Repository navigation
fix(app): dedupe custom vocabulary words within a single batch add - #23061
Merged
Merged
Conversation
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
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.
What
UserProvider.addVocabularyWords(app/lib/providers/user_provider.dart) only deduped abatch add against the already-saved vocabulary (
_transcriptionVocabulary), not againstother words in the same batch, and never dropped blank entries. Typing
omi, omiinSettings → Custom Vocabulary saved two identical
omientries;removeVocabularyWordthen removed every entry equal to the tapped word, so the single "x" on one duplicate chip
deleted both.
Why
Fixes #22793.
Fix
addVocabularyWordsnow tracks aseenset across the whole batch (seeded with theexisting vocabulary) and skips blank/duplicate entries before appending, so a batch add
saves each distinct word once. No change to
removeVocabularyWord: once duplicates can nolonger 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.dartreproducing the issue's exact repro (
['omi', 'omi', '', 'alpha']and an all-duplicatebatch). Confirmed both new tests fail against unmodified
user_provider.dartwith theexact 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 inthe surrounding feature.
UI-Evidence: none -- pure provider logic change (list dedup in
addVocabularyWords), no widget/rendering changeProduct 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.