Skip to content

Commit 41b0d22

Browse files
committed
try to fix player not rendered
1 parent 15f131f commit 41b0d22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/frontend/components/TrackMap/hooks/useDriverProgress.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
useDriverCarIdx,
44
useSessionDrivers,
55
useTelemetryValuesMapped,
6+
useSessionStore,
67
} from '@irdashies/context';
78

89
// Throttle updates to reduce processing load
@@ -15,6 +16,7 @@ export const useDriverProgress = () => {
1516
'CarIdxLapDistPct',
1617
(val) => Math.round(val * 1000) / 1000 // Reduce precision to 2 decimal places to minimize unnecessary updates
1718
);
19+
const paceCarIdx = useSessionStore((s) => s.session?.DriverInfo?.PaceCarIdx) ?? -1;
1820

1921
// Throttled state to reduce update frequency
2022
const [throttledLapDist, setThrottledLapDist] = useState<number[]>([]);
@@ -39,8 +41,8 @@ export const useDriverProgress = () => {
3941
isPlayer: driver.CarIdx === driverIdx,
4042
}))
4143
.filter((d) => d.progress > -1) // ignore drivers not on track
42-
.filter((d) => d.driver.CarIdx > 0); // ignore pace car for now
43-
}, [drivers, throttledLapDist, driverIdx]);
44+
.filter((d) => d.driver.CarIdx > -1 && d.driver.CarIdx !== paceCarIdx); // ignore pace car
45+
}, [drivers, throttledLapDist, driverIdx, paceCarIdx]);
4446

4547
return driversTrackData;
4648
};

0 commit comments

Comments
 (0)