Skip to content

Commit 3bac286

Browse files
authored
fix(custom text modal): reset practise words on submit (@Quiggleson) (monkeytypegame#6927)
### Description There was a bug in which the displayed text in the custom text modal was not being saved when submitted. This occurred when users opened the custom text modal while taking a test with practice words. The new behavior is clicking "ok" in the custom text modal calls `resetBefore()` from `practise-words.ts` to prevent the test from reverting to the previous list of words. ### Tests |Action|Behavior| |---|---| |Submit some text in the custom text modal without practicing words|The text in the modal's text area is displayed in the test| |Submit some text in the custom text modal during a test with practice words|The text in the modal's text area is displayed in the test| |set the custom text to practice words twice in a row|The text in the modal's text area is displayed in the test| |change the custom text during a test with practice words|The text in the modal's text area is displayed in the test| ### Checks - [ ] Adding quotes? - [ ] Make sure to include translations for the quotes in the description (or another comment) so we can verify their content. - [ ] Adding a language? - Make sure to follow the [languages documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/LANGUAGES.md) - [ ] Add language to `packages/schemas/src/languages.ts` - [ ] Add language to exactly one group in `frontend/src/ts/constants/languages.ts` - [ ] Add language json file to `frontend/static/languages` - [ ] Adding a theme? - Make sure to follow the [themes documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/THEMES.md) - [ ] Add theme to `packages/schemas/src/themes.ts` - [ ] Add theme to `frontend/src/ts/constants/themes.ts` - [ ] Add theme css file to `frontend/static/themes` - [ ] Add some screenshot of the theme, especially with different test settings (colorful, flip colors) to your pull request - [ ] Adding a layout? - [ ] Make sure to follow the [layouts documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/LAYOUTS.md) - [ ] Add layout to `packages/schemas/src/layouts.ts` - [ ] Add layout json file to `frontend/static/layouts` - [ ] Adding a font? - Make sure to follow the [themes documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/FONTS.md) - [ ] Add font file to `frontend/static/webfonts` - [ ] Add font to `packages/schemas/src/fonts.ts` - [ ] Add font to `frontend/src/ts/constants/fonts.ts` - [ ] Check if any open issues are related to this PR; if so, be sure to tag them below. - [x] Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info) - [x] Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title. <!-- label(optional scope): pull request title (@your_github_username) --> <!-- I know I know they seem boring but please do them, they help us and you will find out it also helps you.-->
1 parent 01f981c commit 3bac286

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

frontend/src/ts/modals/custom-text.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as ChallengeController from "../controllers/challenge-controller";
66
import Config, * as UpdateConfig from "../config";
77
import * as Strings from "../utils/strings";
88
import * as WordFilterPopup from "./word-filter";
9+
import * as PractiseWords from "../test/practise-words";
910
import * as Notifications from "../elements/notifications";
1011
import * as SavedTextsPopup from "./saved-texts";
1112
import * as SaveCustomTextPopup from "./save-custom-text";
@@ -387,6 +388,7 @@ function apply(): void {
387388
ChallengeController.clearActive();
388389
ManualRestart.set();
389390
if (Config.mode !== "custom") UpdateConfig.setMode("custom");
391+
PractiseWords.resetBefore();
390392
TestLogic.restart();
391393
hide();
392394
}

0 commit comments

Comments
 (0)