mirror of
https://github.com/ankitects/anki.git
synced 2026-09-10 14:38:10 -04:00
## Linked issue (required) Fixes #5516 ## Summary / motivation (required) Make the existing FSRS parameter unlock timing API available before the parameter editor is mounted, and retain the host's chosen timeout when FSRS is disabled and enabled again. Register the API and store its timeout in the component's module script; keep click tracking local to each editor instance. ## Steps to reproduce (required, use N/A if not applicable) 1. Open the deck-options page with FSRS disabled. 2. In that page's JavaScript console, run `anki.setParameterUnlockClickTimeoutMs(1000)`. 3. Before this fix, the call throws `TypeError: anki.setParameterUnlockClickTimeoutMs is not a function`. ## How to test (required) ### Checklist (minimum) - [x] I ran `just check` locally. - [x] I added a browser regression for the changed behavior. ### Details - The regression failed on the original implementation at the pre-mount setter call and passes with the fix. - It checks configuration before the first mount, retention across remounts, updates while absent and present, the three-click gate, the default timeout, and reset after page reload. Playwright's clock controls the click intervals. - `just test-ts`: 61 tests passed. - `just test-e2e`: 27 tests passed, using the repository's disposable Anki harness. - `just check`: passed, including 572 Rust tests and the Python, formatting, lint, and type checks. - The Qt checks emitted an audio-thread warning (`mw` was `None` in `qt/aqt/sound.py`); all 93 Qt tests passed and `just check` exited successfully. ## Before / after behavior (optional) Before: the API exists only after the editor mounts, and mounting a new editor resets the timeout to 500 ms. After: the API exists when the deck-options JavaScript loads, and the selected timeout lasts for the page's lifetime. ## Risk / compatibility / migration (optional) Existing API names, the 500 ms default, and the three-click requirement are preserved. Click counts and pending timers remain local to each editor. No stored data or scheduling behavior changes. ## UI evidence (required for visual changes; otherwise N/A) N/A. ## Scope - [x] This PR is focused on one change. Developed with assistance from Codex.