Skip to content

Commit

Permalink
Dictionary input should display unique words
Browse files Browse the repository at this point in the history
- Fixes #363
  • Loading branch information
kamilmielnik committed Oct 26, 2024
1 parent 7f87d9b commit 6350fa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions cypress/e2e/bugs.spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ import './bugs/333-disabled-radio-cursor';
import './bugs/342-results-sorting';
import './bugs/348-results-word-padding';
import './bugs/352-dictionary-race-condition';
import './bugs/363-dictionary-input-unique-words';
4 changes: 3 additions & 1 deletion packages/scrabble-solver/src/state/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ function* onLocaleChange({ payload: locale }: PayloadAction<Locale>): AnyGenerat
function* onResultCandidateChange({ payload: result }: PayloadAction<Result | null>): AnyGenerator {
if (result) {
const locale: Locale = yield select(selectLocale);
yield put(dictionarySlice.actions.changeInput(result.words.join(LOCALE_FEATURES[locale].separator)));
const uniqueWords = Array.from(new Set(result.words));
const input = uniqueWords.join(LOCALE_FEATURES[locale].separator);
yield put(dictionarySlice.actions.changeInput(input));
yield put(dictionarySlice.actions.submit());
}
}
Expand Down

0 comments on commit 6350fa1

Please sign in to comment.