Conversation
|
In // current
ngettext(
"You have {{count}} active correspondence game that will not be paused by vacation:",
"You have {{count}} active correspondence games that will not be paused by vacation:",
no_vacation_games.length,
).replace("{{count}}", String(no_vacation_games.length))
// should be
interpolate(
ngettext(
"You have {{count}} active correspondence game that will not be paused by vacation:",
"You have {{count}} active correspondence games that will not be paused by vacation:",
no_vacation_games.length,
),
{ count: no_vacation_games.length },
)The rest of the codebase uses |
Review notesTournament.tsx — checkbox may be uncontrolled for existing tournaments When an existing tournament is loaded and the API response does not include a Fix: VacationSettings.tsx — ui/overview is a heavyweight call for a narrow query The component fetches |
ReviewTwo issues worth addressing before merge: 1. Missing fetch cleanup in The new React.useEffect(() => {
get("ui/overview")
.then(...)
.catch(errorAlerter);
return () => {
abort_requests_in_flight("ui/overview");
};
}, []);2.
interface Game {
// existing fields...
no_vacation?: boolean;
time_per_move?: number;
}Without this, TypeScript won't warn if these fields are renamed or removed from the API response. |
|
Bug:
.no-vacation-warning {
color: var(--warning-bg); /* bug */
font-weight: bold;
}
Type issue:
no_vacation: boolean; // required — but field may be absent in API response for existing tournamentsExisting tournaments loaded from the backend will not have |
Code ReviewGameInfoModal no-vacation warning may never display In GameDock.tsx::showGameInfo() (line 172-181), certain fields are explicitly copied from goban.engine.config to goban.config before the modal is opened -- komi, rules, handicap, handicap_rank_difference, rengo, rengo_teams -- but no_vacation is not in this list. If the server sends no_vacation on goban.engine.config (via the socket game data) but not directly on goban.config, the check in GameInfoModal.tsx: will always be undefined and the warning will silently never appear. The type cast is required precisely because no_vacation is not in the GobanConfig type, which makes this easy to overlook. Worth explicitly adding no_vacation to the copy list in GameDock.tsx to be safe, mirroring the established pattern already used for rengo and handicap. |
Code Review NotesInconsistency between
// VacationSettings.tsx
const games = result.active_games.filter(
(g) => g.no_vacation && (g.time_per_move ?? 0) >= 3600,
);But // GameInfoModal.tsx
{(config as GobanConfig & { no_vacation?: boolean }).no_vacation && (
<dd className="no-vacation-warning">
Vacation is disabled for this game. The clock will not pause for vacation.
</dd>
)}If a non-correspondence game ever has
The new checkbox is added to the settings table without any condition on the tournament's speed. Since vacation has no effect on live or blitz game clocks, enabling Hiding or disabling the checkbox when the selected speed is not correspondence would prevent TDs from enabling it unintentionally and would eliminate the inconsistency with |
Code ReviewBug: Spurious error alert on navigation in VacationSettings.tsx In the new useEffect that fetches ui/overview, when the user navigates away from the Settings page while the request is still in-flight, the cleanup calls abort_requests_in_flight which aborts the fetch and causes the Promise to reject with an AbortError. That rejection flows into .catch(errorAlerter), showing a spurious 'An error has occurred' alert during normal navigation. requests.ts line 174 confirms AbortErrors are not suppressed — they are re-rejected to callers. errorAlerter has no special handling for AbortError either. The pattern used in Settings.tsx (a canceled flag checked before calling setState/errorAlerter) avoids this. The simplest fix is to filter the abort in the catch handler, e.g. checking err?.name !== 'AbortError' before calling errorAlerter. |
Code ReviewVacationSettings.tsx — abort_requests_in_flight in cleanup may cancel unrelated requests The cleanup function calls abort_requests_in_flight("ui/overview"), which globally cancels all in-flight requests to that endpoint — including any initiated by other components (Home.tsx also fetches ui/overview). The canceled = true flag is already sufficient to prevent stale state updates on unmount; the abort_requests_in_flight call is redundant and potentially harmful if both pages happen to be in flight simultaneously. Tournament.tsx — no_vacation not cleared when time control speed changes setTimeControl only updates time_control_parameters without resetting no_vacation. If a user enables no-vacation on a correspondence tournament and then switches the speed to live (hiding the checkbox), submitting the form will still send no_vacation: true for a non-correspondence tournament. Fixing it would be a one-liner in setTimeControl: |
ReviewOne issue worth addressing: VacationSettings.tsx — global abort for a component-scoped request The cleanup for the new useEffect calls abort_requests_in_flight("ui/overview"), which cancels all in-flight requests to that URL globally, including any made by Home.tsx. The canceled boolean flag already correctly prevents stale state updates after unmount, so the abort is both redundant and a latent hazard — if routing ever renders both components simultaneously, the Settings unmount would silently cancel the Home page's overview fetch. The safest minimal fix is to drop the abort_requests_in_flight call entirely and rely solely on the canceled flag, which already handles the unmount case correctly. If request cancellation is desired for bandwidth reasons, the correct scoping is via an AbortController instance rather than the URL-keyed global mechanism. |
|
Claude reckons that abort is consistent with how the rest of Settings does it. Plus Home and Vacation pane can't be mounted at the same time. |
Code ReviewFound one real bug: Bug: wrong CSS variable for warning text color in GameInfoModal.css The new The Settings.css version of the same class correctly uses
|
Code Review
The cleanup function in the new The
(goban.config as any)[k] = (goban.engine.config as any)[k];
|
Code ReviewOne issue found in the new code: VacationSettings.tsx — redundant abort_requests_in_flight call In the new useEffect cleanup: return () => {
canceled = true;
abort_requests_in_flight("ui/overview");
};The Since |
|
Reviewed for bugs and performance issues — nothing significant found. The implementation looks correct:
|
Fixes complaining about vacation effects on tournaments
Proposed Changes
Needs: https://github.com/online-go/ogs/pull/2345