Repository navigation
Add Fotcast extension - #30979
Add Fotcast extension#30979fcarysnyder wants to merge 8 commits into
Conversation
Daily football matches from FotMob: favorite teams and leagues, day navigation, live scores, and a match view with scoreboard, lineups, substitutions, ratings and stats. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Congratulations on your new Raycast extension! 🚀 We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days. Once the PR is approved and merged, the extension will be available on our Store. |
Greptile SummaryAdds the Fotcast Raycast extension for browsing football fixtures and live scores, managing favorite teams and leagues, and viewing detailed match information.
Confidence Score: 3/5The PR does not yet appear safe to merge because favorite mutations can still discard concurrent updates and some later substitution events can still disappear. The favorite change is only a partial fix: reading LocalStorage immediately before each write narrows the stale-cache window, but two overlapping toggles can still both read the same value and the later write can overwrite the earlier one. The previous substitution finding also remains unresolved because fallback filtering still excludes a player solely when their ID appeared in any complete swap, without considering the later event’s time and direction. Files Needing Attention: extensions/fotcast/src/store.ts, extensions/fotcast/src/schedule.ts Important Files Changed
Reviews (8): Last reviewed commit: "Close the cross-window gap in the favori..." | Re-trigger Greptile |
| toggleTeam: (team: Favorites["teams"][number]) => | ||
| setValue({ | ||
| ...favorites, | ||
| teams: favorites.teams.some((t) => t.id === team.id) | ||
| ? favorites.teams.filter((t) => t.id !== team.id) | ||
| : [...favorites.teams, team], | ||
| }), | ||
| toggleLeague: (league: Favorites["leagues"][number]) => | ||
| setValue({ | ||
| ...favorites, | ||
| leagues: favorites.leagues.some((l) => l.id === league.id) | ||
| ? favorites.leagues.filter((l) => l.id !== league.id) | ||
| : [...favorites.leagues, league], | ||
| }), |
There was a problem hiding this comment.
Favorite updates overwrite each other
Rapid or concurrent favorite changes can overwrite each other because both setters build the entire next value from the favorites captured during the current render. useLocalStorage does not support functional updates or synchronize separate hook instances, so two quick toggles—or writes from the Matches and Favorites commands while both are open—can start from the same stale value. The later write then silently discards the earlier favorite change.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/fotcast/src/store.ts
Line: 22-35
Comment:
**Favorite updates overwrite each other**
Rapid or concurrent favorite changes can overwrite each other because both setters build the entire next value from the `favorites` captured during the current render. `useLocalStorage` does not support functional updates or synchronize separate hook instances, so two quick toggles—or writes from the Matches and Favorites commands while both are open—can start from the same stale value. The later write then silently discards the earlier favorite change.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
pernielsentikaer
left a comment
There was a problem hiding this comment.
Hi @fcarysnyder 👋
Thanks for contributing Fotcast! We already have Fotmob in the Store by @sonla58, covering schedules, scores, match details, and favorites on macOS and Windows.
The pinned favorites and graphical match presentation look like useful enhancements. Would you be open to contributing them to the existing extension instead? If there’s a reason that wouldn’t work, could you explain it here? 🙂
I’ll convert this PR into a draft after submitting this review. Please press Ready for review when it’s ready and we’ll have a look 😊
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Greptile flagged this in review: it lives outside src/, is excluded from tsconfig's src/**/* project, and isn't the file Raycast actually runs for the matches command. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
hi @pernielsentikaer - thanks for getting back so quick! I built this as a separate app because the two products have different scope. The Fotmob app you shared is 10 entity-focused commands (search teams, search players, team detail, player detail, league table, match detail by ID, etc.), which is a general browsing tool. Fotcast is two commands built around one flow: a day's schedule with your favorite teams/leagues pinned to the top. This one is more of a "fotmob companion" that lets you do two things:
My app also goes deeper on the match view itself: their Match Detail is a separate command you launch with a typed-in match ID, and it shows text stat bars and formation names but no lineups or ratings. Mine opens straight from a match row and renders a pitch chart of both starting elevens, substitutions with minutes, and color-coded player ratings. If I were to bring that level of detail to their app across league tables, teams, and matchdays too, that's more surface area than I'm willing to take on. I figured all the above warrant a different application but I'm open to contacting the other dev and seeing if I can contribute to their repo if necessary. |
pernielsentikaer
left a comment
There was a problem hiding this comment.
Hi @fcarysnyder 👋 Thanks for explaining! The favorites-first flow and graphical lineups are useful improvements. We’d prefer bringing those into Fotmob by @sonla58 rather than adding another integration for the same service.
That wouldn’t need to mean expanding every existing command. Would you be open to discussing a focused contribution with @sonla58? 🙂
|
Contributing this back to the Fotmob app really means one of two things:
Neither is worth it to me. If you're saying Fotcast can't stand alone as its own extension, I'm happy to close this out. I appreciate your time either way. |
pernielsentikaer
left a comment
There was a problem hiding this comment.
Hi @fcarysnyder 👋
Thanks for explaining—we’re happy to allow Fotcast as a separate extension.
Could you address the remaining Greptile feedback? I verified that overlapping favorite updates can discard changes, parent-league favorites aren’t consistently handled by match-row actions, and same-minute substitutions can pair the wrong players.
Please preserve overlapping favorite changes, make league toggles consistent with the parent-aware grouping, and use actual substitution pairings—or display incoming/outgoing players separately when pairing data isn’t available. 🙂
Addresses the three remaining Greptile P1 findings on PR raycast#30979: - useFavorites now tracks the latest value in a ref so two toggles fired before a re-render chain instead of the second clobbering the first (useLocalStorage's setValue has no functional-updater form). - Match rows now resolve a league's favorite status and toggle target through favoriteLeagueEntry (shared with buildSections), so a league favorited by parentLeagueId no longer shows "Favorite" and creates a duplicate entry keyed by primaryId. - Substitution lines use FotMob's actual [in, out] swap pairing from matchFacts.events instead of pairing independently-sorted in/out lists by index, which could cross wires on same-minute multi-subs. Falls back to unpaired in/out lines, never a guess, when swap data is missing. pairSubstitutions and favoriteLeagueEntry are extracted to schedule.ts (pure logic, per the existing file split) with tests covering both the paired and fallback paths. Co-Authored-By: Claude Sonnet 5 <[email protected]>
- Delete fetchAllLeagues, AllLeagues, LeagueRef (zero callers anywhere). - Trim Team/MatchStatus/Match/MatchDayLeague/lineup type fields that mirror FotMob's API but nothing in src/ ever reads. - Extract toggleFavorite(wasFavorite, name, run) to store.ts, shared by matches.tsx and favorites.tsx instead of two near-identical toggle-then-toast blocks. - Delete isFavoriteMatch, exported from schedule.ts but only ever called by the test; the test now inlines hasFavoriteTeam || isFavoriteLeague. - Drop the unused export on MatchState and SubLine (never imported outside schedule.ts). Net -51 lines. typecheck/lint/tests clean. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Addresses a Greptile P1 on schedule.ts:75-84. The old branch treated 'any complete swap pair present' as all-or-nothing: if even one substitution had a full [in, out] pair, the function returned only the paired subs and silently dropped any other substitution whose swap event was missing or incomplete, even though it was still available from the roster's own subIn/subOut records. Now pairs by substitution instead of branching on the array as a whole: each sub with a complete swap pair renders paired, and any sub not covered by a pair (tracked by player id) falls back to its own unpaired in/out line instead of disappearing. Co-Authored-By: Claude Sonnet 5 <[email protected]>
| ...ins | ||
| .filter((e) => !pairedIds.has(e.id)) | ||
| .map((e) => ({ ...e, direction: "in" as const })), | ||
| ...outs | ||
| .filter((e) => !pairedIds.has(e.id)) | ||
| .map((e) => ({ ...e, direction: "out" as const })), |
There was a problem hiding this comment.
If a substitute enters in a complete swap and later leaves in an incomplete swap, pairedIds already contains that player's ID. The fallback therefore removes the later subOut event even though it has a different time and direction, so the match details omit that substitution. Match paired events by time and direction as well as player ID.
Knowledge Base Used: Extension command implementation patterns
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/fotcast/src/schedule.ts
Line: 85-90
Comment:
**Later Substitution Disappears**
If a substitute enters in a complete swap and later leaves in an incomplete swap, `pairedIds` already contains that player's ID. The fallback therefore removes the later `subOut` event even though it has a different time and direction, so the match details omit that substitution. Match paired events by time and direction as well as player ID.
**Knowledge Base Used:** [Extension command implementation patterns](https://app.greptile.com/raycast/-/custom-context/knowledge-base/raycast/extensions/-/docs/extension-command-implementation.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.The earlier fix (a useRef tracking the latest value) only solved toggles racing within one command window; the ref is per-instance, so it did nothing for the other scenario the original Greptile comment named: writes from the Matches and Favorites commands while both are open. The review thread on store.ts stayed unresolved because that gap was real. useLocalStorage just wraps LocalStorage.getItem/setItem with a plain JSON round-trip (confirmed against its own source — no reviver needed for a Date/Buffer-free type like Favorites), so toggles now read LocalStorage directly right before writing instead of trusting any cached snapshot, React state or ref. Not a true compare-and-swap — Raycast's LocalStorage has no locking primitive for that — but it removes the stale-cache window that made overlapping writes a coin flip. Simpler than the ref version too: no extra hook, no manual cache tracking. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
apologies - I ran |
|
Continued in #31030. |
Description
Adds Fotcast, an extension for daily football matches and scores from
FotMob.
Each row's subtitle is the kickoff time before the match starts, then the
live match clock (minute, HT, FT) once it starts. The right side shows the
home crest, a score badge, and the away crest, with the badge coloured by
your favorite club's result once the match finishes.
Favorite-team matches are pinned to a
★ Teamssection, favorite leagueseach get a
★ <league>section, and an All Leagues / Favorites dropdownswitches between the full day and just your pinned sections.
current day.
crests, score, goals and red cards, a pitch chart of both starting lineups
with formations, substitutions, player ratings in FotMob's own colour
scale, and a sidebar with kickoff, competition, stadium, referee,
attendance and top match stats.
The extension calls FotMob's public web endpoints, which are undocumented
and unofficial; there's no API key, no sign-in, and no preferences to
configure. Runs on macOS and Windows.
Screencast
Screenshots in
metadata/:fotcast-1.png— Matches command, All Leagues view, showing the ★ Teamspin and multiple Champions League fixtures with live clocks and scores.
fotcast-2.png— Match detail view: scoreboard, score, and goal-scorerlist for Manchester United vs Sabah FK.
fotcast-3.png— Match detail view: pitch chart of both startinglineups with formations and substitutions.
fotcast-4.png— Match detail view: full player ratings table for bothsides.
fotcast-5.png— Favorites command listing a favorited team and twofavorited leagues.
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool🤖 Generated with Claude Code