Did you clear cache before opening an issue?
Is there an existing issue for this?
Does the issue happen when logged in?
N/A
Does the issue happen when logged out?
Yes (source-code bug, independent of account state)
Does the issue happen in incognito mode when logged in?
N/A
Does the issue happen in incognito mode when logged out?
N/A
Issue details
Current Behavior
Two bugs in frontend/src/ts/elements/monkey-power.ts (Monkey Power screen-shake/spark effect):
1. reset() clears an already-deleted timeout id (monkey-power.ts:171-175):
export function reset(immediate = false): void {
if (!isSafeNumber(ctx.resetTimeOut)) return;
delete ctx.resetTimeOut; // id removed first...
clearTimeout(ctx.resetTimeOut); // ...so this clears `undefined` — always a no-op
The property is deleted before clearTimeout reads it, so the pending 2000ms shake-reset timeout scheduled in addPower() (monkey-power.ts:222-223) is never actually cancelled and always fires later, re-running reset() even after it was already invoked early (e.g. from test-ui.ts:1854). This can cause a delayed/duplicate body-transform reset.
2. randomColor() produces invalid hex colors (monkey-power.ts:198-203):
const r = Math.floor(Math.random() * 256).toString(16); // can be 1 char, e.g. "a"
return `#${r}${g}${b}`; // e.g. "#fa2" — invalid CSS color
Channel values below 16 produce single-digit hex strings without zero-padding, generating malformed 3–5 character colors like #fa2c or #a12. Sparks randomly lose their intended color.
Expected Behavior
clearTimeout(ctx.resetTimeOut);
delete ctx.resetTimeOut;
and
const toHex = (n: number) => n.toString(16).padStart(2, "0");
Steps To Reproduce
- Enable Monkey Power level 3+ in settings.
- Type quickly to trigger powers repeatedly and reset mid-shake.
- Observe the delayed shake reset firing ~2s after
reset() was already called; sparks intermittently render with broken/no color.
Environment
- OS: Any
- Browser: Any
- Found via source review of
master @ 91bd24b
Did you clear cache before opening an issue?
Is there an existing issue for this?
Does the issue happen when logged in?
N/A
Does the issue happen when logged out?
Yes (source-code bug, independent of account state)
Does the issue happen in incognito mode when logged in?
N/A
Does the issue happen in incognito mode when logged out?
N/A
Issue details
Current Behavior
Two bugs in
frontend/src/ts/elements/monkey-power.ts(Monkey Power screen-shake/spark effect):1.
reset()clears an already-deleted timeout id (monkey-power.ts:171-175):The property is deleted before
clearTimeoutreads it, so the pending 2000ms shake-reset timeout scheduled inaddPower()(monkey-power.ts:222-223) is never actually cancelled and always fires later, re-runningreset()even after it was already invoked early (e.g. fromtest-ui.ts:1854). This can cause a delayed/duplicate body-transform reset.2.
randomColor()produces invalid hex colors (monkey-power.ts:198-203):Channel values below 16 produce single-digit hex strings without zero-padding, generating malformed 3–5 character colors like
#fa2cor#a12. Sparks randomly lose their intended color.Expected Behavior
and
Steps To Reproduce
reset()was already called; sparks intermittently render with broken/no color.Environment
master@ 91bd24b