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
@@ -148,6 +148,7 @@ export function renderTrainingView(deps) {
|
||||
setSelectedDriverId,
|
||||
getSelectedClassId,
|
||||
setSelectedClassId,
|
||||
isInitialLoadDone = () => true,
|
||||
} = deps;
|
||||
|
||||
state.training = normalizeTrainingState(state.training);
|
||||
@@ -156,7 +157,12 @@ export function renderTrainingView(deps) {
|
||||
.sort((left, right) => String(left.representative?.name || "").localeCompare(String(right.representative?.name || "")));
|
||||
let selectedProfileId = String(getSelectedDriverId() || "");
|
||||
let selectedProfile = resolveTrainingProfile(profiles, selectedProfileId);
|
||||
if (selectedProfileId && !selectedProfile) {
|
||||
if (selectedProfileId && !selectedProfile && !isInitialLoadDone()) {
|
||||
// A driver from a link (?driver=) that isn't known yet because the server data is still
|
||||
// loading: show the overview for now but keep the selection, so the re-render after the
|
||||
// load opens that driver instead of losing it.
|
||||
selectedProfileId = "";
|
||||
} else if (selectedProfileId && !selectedProfile) {
|
||||
selectedProfileId = "";
|
||||
setSelectedDriverId("");
|
||||
setSelectedClassId("");
|
||||
|
||||
Reference in new issue
Block a user