fix: keep competition order when merging cached standings - #26
Conversation
Co-Authored-By: Itamar Sharify <itamarsharify@gmail.com>
Original prompt from Itamar
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, localized, and correctly preserves requested league ordering while maintaining the fresh-else-previous behavior for partial failures.
Pull request overview
This PR adjusts snapshot merging in convex/football.ts so that when standings are partially served from cache (because a subset of standings fetches fail), the resulting leaguesData order matches the order of team.runningCompetitions instead of appending “kept” cached leagues at the end.
Changes:
- Replace set/filter-based “kept leagues” merging with per-
leagueIdselection (fresh-first, else previous). - Build
leaguesDataby iteratingrequestedLeagueIdsto preserve competition ordering deterministically.
File summaries
| File | Description |
|---|---|
| convex/football.ts | Reworks mergeWithPrevious league merge logic to preserve competition order while retaining cached entries for failed standings requests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@devin review and commit fixes |
|
Reviewed: Copilot approved with zero findings, CI green, no conflicts with main (including the #27 changes to |
Summary
Follow-up to #25:
mergeWithPreviousnow buildsleaguesDataby iteratingrequestedLeagueIds(the order ofteam.runningCompetitions) and picking fresh-else-previous per id, so a failed standings request no longer shuffles that competition's table to the end.Requires
npx convex deployafter merge.Link to Devin session: https://app.devin.ai/sessions/3fc3db4656ca4cd7a03c1bf5a7182f15
Open in Devin Desktop: https://app.devin.ai/desktop/session/3fc3db4656ca4cd7a03c1bf5a7182f15?variant=devin
Requested by: @ItamarShDev