fix(test): recover pace caret after word generation gaps (@anuragkej)#7560
fix(test): recover pace caret after word generation gaps (@anuragkej)#7560anuragkej wants to merge 46 commits intomonkeytypegame:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an edge case where the pace caret can disappear when it advances into yet-to-be-generated words (e.g., Plus Three), by adding a safe retry mechanism and a terminal stop condition to avoid endless hidden-caret loops.
Changes:
- Update pace-caret stepping to retain state on “out of words” and retry updates while more words may still be generated.
- Stop retrying (and clear pace-caret settings) when word generation is terminal for the current mode/limits.
- Add Vitest unit coverage for the recovery and terminal-stop behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
frontend/src/ts/test/pace-caret.ts |
Adds retry scheduling + terminal exhaustion detection; refactors stepping to return success/failure. |
frontend/__tests__/test/pace-caret.spec.ts |
Adds targeted tests around recovery vs terminal-stop behavior. |
| function areAllTestWordsGenerated(): boolean { | ||
| if (Config.mode === "words") { | ||
| return TestWords.words.length >= Config.words && Config.words > 0; | ||
| } | ||
|
|
||
| if (Config.mode === "quote") { |
There was a problem hiding this comment.
areAllTestWordsGenerated() duplicates TestLogic.areAllTestWordsGenerated() logic (frontend/src/ts/test/test-logic.ts:572-590). This risks drift if generation/limit rules change. Consider extracting this predicate into a small shared module (importable by both) or otherwise centralizing it so pace-caret and test-logic stay consistent.
| await PaceCaret.update(0); | ||
|
|
There was a problem hiding this comment.
This recovery test doesn’t exercise the new timer-based retry path: it manually calls PaceCaret.update(0) again after pushing a word, instead of letting the scheduled retry fire. To validate the fix end-to-end, assert a retry timer was scheduled after the first failure and then advance/run fake timers (and flush pending promises) to confirm the caret state recovers via the scheduled update.
| await PaceCaret.update(0); | |
| expect(vi.getTimerCount()).toBeGreaterThan(0); | |
| await vi.runOnlyPendingTimersAsync(); | |
| await Promise.resolve(); |
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
…typegame#7558) Co-authored-by: Jack <jack@monkeytype.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
also add tests for it
also adds tests to existing anime components !nuf
Co-authored-by: Christian Fehmer <cfe@sexy-developer.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ter-events Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Brr --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
also add test
Co-authored-by: Jack <jack@monkeytype.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
…onkeytypegame#7589) ### Description This PR prevents interaction with UI elements while the **"Downloading user data..."** loading state is active. During the initial authentication loading phase ("Downloading user data..."), the UI remains interactive even though the application is still initializing user data. This allows users to hover and interact with elements such as the navbar, footer, and test configuration before the loading process finishes. ### Reproduction 1. Log into an account 2. Refresh the page 3. Move the cursor over navbar icons or other UI elements while the loading bar is visible 4. Notice hover effects and interactions are still possible ### After Fix While the loading process is active, UI interaction is disabled for key interactive sections: - Navbar - Footer - Test configuration panel Users can no longer trigger hover effects or interact with these elements until loading finishes. ### Technical Notes A temporary `loading` class is applied to the `body` element during the loading phase. While active, the following UI sections have interactions disabled: - `header nav` - `footer` - `#testConfig` This is achieved using: ``` pointer-events: none; user-select: none; ``` The class is removed once navigation loading completes. ### 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` - [ ] (optional) Add theme css file to `frontend/static/themes` - [ ] Add some screenshots 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 [fonts 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` - [x] 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. Closes monkeytypegame#7587 --------- Co-authored-by: Miodec <jack@monkeytype.com>
Co-authored-by: Miodec <jack@monkeytype.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- wrong text on public profile test activity "months" instead "last 12 months" - newlines not displayed in profile bio and keyboard

Description
This PR fixes a pace-caret edge case triggered with Plus Three (and similar dynamic word generation scenarios):
Supersedes #7559 (GitHub would not allow reopening it after the source repo was detached from fork network).
Checks
packages/schemas/src/languages.tsfrontend/src/ts/constants/languages.tsfrontend/static/languagespackages/schemas/src/themes.tsfrontend/src/ts/constants/themes.tsfrontend/static/themespackages/schemas/src/layouts.tsfrontend/static/layoutsfrontend/static/webfontspackages/schemas/src/fonts.tsfrontend/src/ts/constants/fonts.tsCloses #7527