Skip to content

Conversation

@tariknz
Copy link
Owner

@tariknz tariknz commented Jul 15, 2025

  • Precalculate x/y coordinates for track percentage
  • Update track direction list
  • Hide broken tracks
  • Better resize logic to use observer instead
  • Reduce complexity around throttling

Copilot AI review requested due to automatic review settings July 15, 2025 01:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances TrackMap performance by precalculating SVG points, refining direction logic, and improving rendering/resizing behavior.

  • Pre-calculate SVG path points and total lengths via a new preCalculatePoints utility.
  • Refactor findDirection to use a dedicated anticlockwiseTracks array.
  • Introduce a broken-tracks registry and conditional rendering to hide unsupported tracks in production.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/svg-utils.ts Extract anticlockwiseTracks array in findDirection and add preCalculatePoints.
tools/generate-paths-json.ts Invoke preCalculatePoints and include totalLength in generated JSON.
src/frontend/components/TrackMap/tracks/broken-tracks.ts New module listing broken tracks and helper functions.
src/frontend/components/TrackMap/hooks/useDriverProgress.tsx Filter out pace car using useSessionStore.
src/frontend/components/TrackMap/TrackDebug.tsx Add debug component for missing or broken track data.
src/frontend/components/TrackMap/TrackCanvas.tsx Refactor canvas: remove manual throttling, use ResizeObserver, hide broken tracks.
src/frontend/components/TrackMap/TrackCanvas.stories.tsx Add stories for single-driver view and a broken-tracks grid.
Comments suppressed due to low confidence (2)

tools/svg-utils.ts:111

  • The function preCalculatePoints uses svgPathProperties but there is no import { svgPathProperties } at the top of the file; add the import to prevent a ReferenceError.
export const preCalculatePoints = (pathData: string): { x: number; y: number }[] => {

src/frontend/components/TrackMap/TrackCanvas.stories.tsx:429

  • The variable sampleData is not defined in this scope, which will cause a runtime error; ensure you import or define a valid drivers array for the story.
                  drivers={sampleData} 

@tariknz tariknz merged commit 4177c55 into main Jul 15, 2025
1 check passed
@tariknz tariknz deleted the chore/perf-trackmap-precalculate-points branch July 15, 2025 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants