fix(training): keep a linked driver until the first server load finishes
A ?driver= link to Training stats was cleared when the page rendered from the local copy before the server data arrived. The selection now survives until the first load settles, then the driver opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
af79b610db
commit
efa082c2b5
7 files changed
+35
-6
No files matched your search
+6
-1
@@ -578,7 +578,7 @@ const renderArchive = () => renderResultsArchiveView({
|
||||
getSelectedSessionId: () => archiveSelectedSessionId, setSelectedSessionId: (value) => { archiveSelectedSessionId = value; },
|
||||
getTrackLayoutLabel,
|
||||
});
|
||||
const renderTraining = () => renderTrainingView({ addTrackLayout, state, dom, t, escapeHtml, formatLap, formatRaceClock, uid, saveState, syncStateToBackend, renderView, normalizeTrainingState, syncTrainingLedger, buildDriverTrainingStats, buildDriverTimingChannelStats: buildDriverTimingChannelStatsLogic, buildDriverActivePracticeStats, buildEvenLapsProgress, buildStepTrainingProgress, buildTrainingRecommendation, getTrainingGoalProgress, getNextTrainingMilestone, buildTrainingMissions: buildTrainingMissionsLogic, buildTrainingHighlights: buildTrainingHighlightsLogic, getClubTrainingGoalProgress: getClubTrainingGoalProgressLogic, countDriverExerciseSessions: countDriverExerciseSessionsLogic, countExerciseSessions: countExerciseSessionsLogic, buildTrainingPaceBuckets: buildTrainingPaceBucketsLogic, buildTrainingWeekdayStats: buildTrainingWeekdayStatsLogic, buildTrainingStintAnalysis: buildTrainingStintAnalysisLogic, buildTrainingMarkerComparisons: buildTrainingMarkerComparisonsLogic, getSelectedDriverId: () => selectedTrainingDriverId, setSelectedDriverId: (value) => { selectedTrainingDriverId = value; updateViewUrl("training", value, selectedTrainingClassId); }, getSelectedClassId: () => selectedTrainingClassId, setSelectedClassId: (value) => { selectedTrainingClassId = value; updateViewUrl("training", selectedTrainingDriverId, value); } });
|
||||
const renderTraining = () => renderTrainingView({ addTrackLayout, state, dom, t, escapeHtml, formatLap, formatRaceClock, uid, saveState, syncStateToBackend, renderView, normalizeTrainingState, syncTrainingLedger, buildDriverTrainingStats, buildDriverTimingChannelStats: buildDriverTimingChannelStatsLogic, buildDriverActivePracticeStats, buildEvenLapsProgress, buildStepTrainingProgress, buildTrainingRecommendation, getTrainingGoalProgress, getNextTrainingMilestone, buildTrainingMissions: buildTrainingMissionsLogic, buildTrainingHighlights: buildTrainingHighlightsLogic, getClubTrainingGoalProgress: getClubTrainingGoalProgressLogic, countDriverExerciseSessions: countDriverExerciseSessionsLogic, countExerciseSessions: countExerciseSessionsLogic, buildTrainingPaceBuckets: buildTrainingPaceBucketsLogic, buildTrainingWeekdayStats: buildTrainingWeekdayStatsLogic, buildTrainingStintAnalysis: buildTrainingStintAnalysisLogic, buildTrainingMarkerComparisons: buildTrainingMarkerComparisonsLogic, isInitialLoadDone: () => initialLoadDone, getSelectedDriverId: () => selectedTrainingDriverId, setSelectedDriverId: (value) => { selectedTrainingDriverId = value; updateViewUrl("training", value, selectedTrainingClassId); }, getSelectedClassId: () => selectedTrainingClassId, setSelectedClassId: (value) => { selectedTrainingClassId = value; updateViewUrl("training", selectedTrainingDriverId, value); } });
|
||||
// Judge corrections are saved as usual and also pushed as this session's result, so the
|
||||
// server's "hot results" protection (live passings in the last 15 s) can't hold them back.
|
||||
const saveCorrectionFor = (session) => () => {
|
||||
@@ -4313,6 +4313,10 @@ let updateStatusLoaded = false;
|
||||
let updateCheckPending = false;
|
||||
let updateNotice = "";
|
||||
let updateNoticeIsError = false;
|
||||
// Set once the first load from the server has finished (or failed): until then the state is
|
||||
// only this browser's local copy, so a driver from a link (?driver=) may simply not be known
|
||||
// yet - views must not treat that as "doesn't exist" and clear the selection.
|
||||
let initialLoadDone = false;
|
||||
const backend = {
|
||||
available: false,
|
||||
lastSyncAt: null,
|
||||
@@ -4401,6 +4405,7 @@ async function init() {
|
||||
setInterval(() => refreshUpdateStatus({ render: currentView === "settings" }), 20 * 60 * 1000);
|
||||
|
||||
Promise.allSettled([hydrateFromBackend(), loadAmmcConfigFromBackend(), refreshServerBackups({ render: false }), refreshUpdateStatus({ render: false })]).finally(() => {
|
||||
initialLoadDone = true;
|
||||
applyTheme();
|
||||
renderNav();
|
||||
renderViewFromBackground();
|
||||
|
||||
Reference in new issue
Block a user