1
This commit is contained in:
@@ -115,18 +115,38 @@ export function readCustomWorldAgentUiState(
|
||||
params.get(CUSTOM_WORLD_GENERATION_SOURCE_QUERY_KEY),
|
||||
),
|
||||
};
|
||||
const storedValue = resolved.sessionStorage?.getItem(
|
||||
CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY,
|
||||
);
|
||||
|
||||
if (
|
||||
stateFromQuery.activeSessionId ||
|
||||
stateFromQuery.activeOperationId ||
|
||||
stateFromQuery.customWorldGenerationSource
|
||||
) {
|
||||
return stateFromQuery;
|
||||
let storedOwnerUserId: string | null = null;
|
||||
if (storedValue) {
|
||||
try {
|
||||
const parsed = JSON.parse(storedValue) as CustomWorldAgentUiState;
|
||||
const storedSessionId = normalizeValue(parsed.activeSessionId);
|
||||
if (
|
||||
storedSessionId &&
|
||||
storedSessionId === stateFromQuery.activeSessionId
|
||||
) {
|
||||
storedOwnerUserId = normalizeValue(parsed.ownerUserId);
|
||||
}
|
||||
} catch {
|
||||
resolved.sessionStorage?.removeItem(CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...stateFromQuery,
|
||||
// URL 只承载可分享的 session 指针,用户归属仍仅来自本机 sessionStorage。
|
||||
...(storedOwnerUserId ? { ownerUserId: storedOwnerUserId } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
const storedValue = resolved.sessionStorage?.getItem(
|
||||
CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY,
|
||||
);
|
||||
if (!storedValue) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user