1
This commit is contained in:
@@ -45,6 +45,7 @@ test('custom world agent ui state reads from query first and persists to session
|
||||
{
|
||||
activeSessionId: 'session-1',
|
||||
activeOperationId: 'operation-1',
|
||||
ownerUserId: 'user-1',
|
||||
},
|
||||
env,
|
||||
);
|
||||
@@ -56,6 +57,13 @@ test('custom world agent ui state reads from query first and persists to session
|
||||
activeOperationId: 'operation-1',
|
||||
});
|
||||
|
||||
currentUrl = '/play';
|
||||
expect(readCustomWorldAgentUiState(env)).toEqual({
|
||||
activeSessionId: 'session-1',
|
||||
activeOperationId: 'operation-1',
|
||||
ownerUserId: 'user-1',
|
||||
});
|
||||
|
||||
clearCustomWorldAgentUiState(env);
|
||||
expect(readCustomWorldAgentUiState(env)).toEqual({});
|
||||
});
|
||||
|
||||
@@ -80,6 +80,7 @@ export function readCustomWorldAgentUiState(
|
||||
return {
|
||||
activeSessionId: normalizeValue(parsed.activeSessionId),
|
||||
activeOperationId: normalizeValue(parsed.activeOperationId),
|
||||
ownerUserId: normalizeValue(parsed.ownerUserId),
|
||||
};
|
||||
} catch {
|
||||
resolved.sessionStorage?.removeItem(CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY);
|
||||
@@ -94,9 +95,11 @@ export function writeCustomWorldAgentUiState(
|
||||
const resolved = resolveEnvironment(env);
|
||||
const activeSessionId = normalizeValue(state.activeSessionId);
|
||||
const activeOperationId = normalizeValue(state.activeOperationId);
|
||||
const ownerUserId = normalizeValue(state.ownerUserId);
|
||||
const nextState: CustomWorldAgentUiState = {
|
||||
activeSessionId,
|
||||
activeOperationId,
|
||||
ownerUserId,
|
||||
};
|
||||
|
||||
if (resolved.location && resolved.history?.replaceState) {
|
||||
|
||||
Reference in New Issue
Block a user