fix: address 6 code-review issues#23
Merged
Merged
Conversation
- ui.js: showRankingTab now passes _onPlayerRowClick to renderRankings() so player rows stay clickable after switching ranking tabs - chart.js: replace canvas.parentElement.innerHTML with a sibling <p> so the canvas is never destroyed when showing "no data" messages - chart.js: use normaliseMatch() so legacy column-shifted matches are handled correctly in the ELO history chart - state.js: extract normaliseMatch() so the column-shift workaround lives in one place instead of being duplicated across state/ui/chart - app.js: move persistPlayers/persistMatches inside the try block and roll back state.matches on saveMatch failure (no more ghost ELO) - app.js: removeMatch only writes back affected players, not all N - branding.js: expand 3-digit hex (#f00) before slicing in darken/hexToRgba https://claude.ai/code/session_01TgxiTLy7fCh5xZPJT8eTVt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 6 bugs surfaced by code review:
ui.js— ranking rows lose click handler after tab switch:showRankingTabwas callingrenderRankings()with no argument, resetting_onPlayerRowClickto null. Now passes the stored callback through.chart.js— canvas destroyed by "no data" message: BothrenderPlayerChartandrenderEloChartwere writing toparentElement.innerHTML, destroying the<canvas>node. Switching chart type then silently showed nothing. Fixed by appending a sibling<p>element and togglingcanvas.style.displayinstead.chart.js+state.js— column-shift workaround missing from chart:buildEloHistoryhad no fix for legacy Google Sheets data, causing the ELO chart to diverge from ranking table values. ExtractednormaliseMatch()fromstate.jsand used it in both places.app.js— ghost ELO on save failure:persistPlayers/persistMatchesran before the Supabase write, leaving stale values in localStorage on network error. Moved persist calls inside the try block; on catch, rolls backstate.matchesand recalculates.app.js— O(N) player updates on match delete:removeMatchwas writing all N players back to Supabase. Now only writes the 2–4 players who appeared in the deleted match.branding.js— 3-digit hex crashes darken/hexToRgba: AddedexpandHex()to convert#f00→#ff0000before slicing.Test plan
npm test)primaryColor: '#f00'in config.js — app loads without broken CSS variableshttps://claude.ai/code/session_01TgxiTLy7fCh5xZPJT8eTVt
Generated by Claude Code