fix: make workspace policy waits selection-safe
This commit is contained in:
@@ -23,12 +23,11 @@ async function selectedPreferences(): Promise<WorkspacePreference> {
|
||||
}
|
||||
|
||||
export async function createSession(i: NewSessionInput) {
|
||||
const preferences = await selectedPreferences();
|
||||
await workspacePolicyGate.waitFor(i.workspaceId ?? preferences.workspaceId);
|
||||
const selection = workspacePreferences.load();
|
||||
await selectedPreferences();
|
||||
const selection = await workspacePolicyGate.waitForCurrent(() => workspacePreferences.load());
|
||||
return apiFetch<{ id: string }>("/sessions", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ...selection, ...i }),
|
||||
body: JSON.stringify({ ...i, ...selection }),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user