mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-16 00:03:02 +00:00
fix: drop a workspace switch superseded while its item check was in flight
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fc92a5e78b
commit
9d705932e6
@@ -131,6 +131,8 @@ function editorHasUnsavedEdits(): boolean {
|
||||
})
|
||||
}
|
||||
|
||||
let latestSwitch = 0
|
||||
|
||||
function switchTo(id: string) {
|
||||
workspaceAIClients.init(id)
|
||||
switchWorkspace(id)
|
||||
@@ -149,7 +151,10 @@ export async function switchWorkspaceAndPage(
|
||||
href?: string
|
||||
}
|
||||
): Promise<void> {
|
||||
const request = ++latestSwitch
|
||||
const missing = !opts?.landOnHome && (await itemPageMissingIn(id))
|
||||
// A switch picked while this lookup was in flight wins.
|
||||
if (request !== latestSwitch) return
|
||||
// Read after the lookup: the user can edit while it is in flight.
|
||||
const unsavedEdits = editorHasUnsavedEdits()
|
||||
if (opts?.landOnHome || unsavedEdits || missing) {
|
||||
|
||||
Reference in New Issue
Block a user