mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 16:03:27 +00:00
fix(frontend): settle the username policy on failure instead of guessing it
`policyLoaded` was set in a `finally`, so a failed policy load unblocked the form with `automateUsername` still at its default — the exact submit the flag exists to prevent. The failure now hands over to the full form, which asks for a username outright rather than inferring one, so the flag is never true while the answer is still a guess. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012fRjnaHLwjpHN84gNNxah9
This commit is contained in:
co-authored by
Claude Opus 5
parent
b4dba2a83b
commit
c17d5a3bdf
@@ -41,9 +41,11 @@
|
||||
let automateUsername = $state(true)
|
||||
let suggestedUsername = $state<string | undefined>(undefined)
|
||||
/**
|
||||
* Whether the username policy has landed. Nothing may be submitted before it does:
|
||||
* Whether the policy is settled, which is what this form may not submit without:
|
||||
* `automateUsername` starts at the common case, and posting that guess to an instance
|
||||
* that derives no usernames sends none where one is required.
|
||||
* that derives no usernames sends none where one is required. A load that fails settles
|
||||
* it by handing over to the full form, which asks for a username outright instead of
|
||||
* inferring one — so this is never true while the answer is still a guess.
|
||||
*/
|
||||
let policyLoaded = $state(false)
|
||||
/** Someone typed while the prefill was in flight; their name wins over the suggestion. */
|
||||
@@ -56,10 +58,13 @@
|
||||
automateUsername = policy.automate
|
||||
suggestedUsername = policy.suggested
|
||||
if (!policy.automate && !policy.suggested) advanced = true
|
||||
policyLoaded = true
|
||||
} catch (error) {
|
||||
console.error('Could not prefill the workspace name:', error)
|
||||
if (!nameEdited) name = 'My workspace'
|
||||
} finally {
|
||||
// The policy is what failed, so there is nothing to submit against. The full form
|
||||
// carries its own username field, which is the version that needs no policy.
|
||||
advanced = true
|
||||
policyLoaded = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user