diff --git a/extensions/f1-standings/.gitignore b/extensions/f1-standings/.gitignore new file mode 100644 index 00000000000..9ff34e3e9f3 --- /dev/null +++ b/extensions/f1-standings/.gitignore @@ -0,0 +1,13 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules + +# Raycast specific files +raycast-env.d.ts +.raycast-swift-build +.swiftpm +compiled_raycast_swift + +# misc +.DS_Store diff --git a/extensions/f1-standings/CHANGELOG.md b/extensions/f1-standings/CHANGELOG.md index f44aff4c6dc..7beaab19328 100644 --- a/extensions/f1-standings/CHANGELOG.md +++ b/extensions/f1-standings/CHANGELOG.md @@ -1,5 +1,9 @@ # F1 Standings Changelog +## [🕦 Show Fastest Lap] - 2024-02-26 + +- Fixed an error when displaying DriverStats for not started seasons + ## [🕦 Show Fastest Lap] - 2023-03-20 - If available the fastest lap is now shown in race results diff --git a/extensions/f1-standings/src/hooks/useDriverStandings.ts b/extensions/f1-standings/src/hooks/useDriverStandings.ts index 22e4f72a321..3985d5e8714 100644 --- a/extensions/f1-standings/src/hooks/useDriverStandings.ts +++ b/extensions/f1-standings/src/hooks/useDriverStandings.ts @@ -30,7 +30,7 @@ const useDriverStandings = (season: string | null): [DriverStanding[], boolean] setState((previous) => ({ ...previous, isLoading: false, - driverStandings: data.MRData.StandingsTable.StandingsLists[0].DriverStandings, + driverStandings: data.MRData.StandingsTable.StandingsLists[0]?.DriverStandings ?? [], })); } catch (error) { await showToast({ diff --git a/extensions/f1-standings/src/views/DriverStandingsList.tsx b/extensions/f1-standings/src/views/DriverStandingsList.tsx index a25870cc136..3b915ede7c0 100644 --- a/extensions/f1-standings/src/views/DriverStandingsList.tsx +++ b/extensions/f1-standings/src/views/DriverStandingsList.tsx @@ -28,6 +28,7 @@ function DriverList() { setSelectedStanding(standings.find((standing) => standing.Driver.driverId === selectedId) || null); }} > + {season && ( {standings.map((standing) => ( @@ -57,4 +58,11 @@ function DriverList() { ); } +function EmptyView({ season }: { season: string | null }) { + if (!season) { + return null; + } + return ; +} + export default DriverList;