Merge pull request #1504 from pikasTech/fix/issue-1496-fresh-rehydrate

fix: 稳定 Workbench fresh session rehydrate
This commit is contained in:
Lyon
2026-06-18 18:40:56 +08:00
committed by GitHub
2 changed files with 2 additions and 2 deletions
@@ -874,7 +874,6 @@ async function loadWorkbenchSession(sessionId: string, seed: WorkbenchSessionRec
const requestId = normalizeWorkbenchSessionRouteId(sessionId);
if (!requestId) return null;
const detail = await api.workbench.session(requestId);
if (!detail.ok) return null;
const detailSession = detail.ok ? sessionFromWorkbenchSession(detail.data?.session) : null;
const id = detailSession?.sessionId ?? normalizeWorkbenchSessionId(requestId) ?? seed?.sessionId;
if (!id) return null;
@@ -26,10 +26,11 @@ const componentActive = ref(false);
onMounted(async () => {
componentActive.value = true;
applyingRouteSession.value = Boolean(rawRouteSessionId.value);
const hydratedRouteTarget = routeReflectionTarget.value;
startWorkbenchOpenJourney({ route: route.path, cache: routeRequestId.value ? "cold" : "warm", authState: "warm" });
try {
await workbench.hydrate({ sessionId: routeRequestId.value, invalidRouteId: rawRouteSessionId.value && !routeRequestId.value ? rawRouteSessionId.value : null });
await applyRouteSession();
if (routeReflectionTarget.value !== hydratedRouteTarget) await applyRouteSession();
finishWorkbenchOpenFullLoad(workbench.error ? "error" : "ok");
} finally {
applyingRouteSession.value = false;