diff --git a/static/onboarding.js b/static/onboarding.js index f1da2852..cc395066 100644 --- a/static/onboarding.js +++ b/static/onboarding.js @@ -370,8 +370,6 @@ function _renderOnboardingBody(){ onModelChange:(value)=>{ ONBOARDING.form.model=(value||'').trim(); }, }); } - const modelSel=$('onboardingModelSelect'); - if(modelSel && ONBOARDING.form.model) modelSel.value=ONBOARDING.form.model; return; } diff --git a/static/ui.js b/static/ui.js index 1ead7f22..8daea7ac 100644 --- a/static/ui.js +++ b/static/ui.js @@ -2538,8 +2538,10 @@ function _mountSearchableModelSelect(opts={}){ customInput.value=''; if(lastListedValue){ selectEl.value=lastListedValue; + onModelChange(lastListedValue); + return; } - applyCustomSelection(); + onModelChange(''); }); customInput.addEventListener('keydown', (event)=>{ if(event.key!=='Enter') return; diff --git a/tests/test_issue1362_codex_oauth_onboarding.py b/tests/test_issue1362_codex_oauth_onboarding.py index 087e388d..ef0a7c71 100644 --- a/tests/test_issue1362_codex_oauth_onboarding.py +++ b/tests/test_issue1362_codex_oauth_onboarding.py @@ -888,9 +888,14 @@ const submitValue = (($('onboardingModelInput') || {}).value || ($('onboardingMo customInput.value = ' '; customInput.dispatch('input'); +const afterWhitespaceClear = { + model: ONBOARDING.form.model, + selectedIndex: selectEl.selectedIndex, + selectValue: selectEl.value, +}; const whitespaceSubmitValue = (($('onboardingModelInput') || {}).value || ($('onboardingModelSelect') || {}).value || ONBOARDING.form.model || '').trim(); -console.log(JSON.stringify({ initial, hiddenStates, afterCustom, afterSelect, submitValue, whitespaceSubmitValue, whitespaceCustomValue: customInput.value })); +console.log(JSON.stringify({ initial, hiddenStates, afterCustom, afterSelect, submitValue, afterWhitespaceClear, whitespaceSubmitValue, whitespaceCustomValue: customInput.value })); """ with tempfile.NamedTemporaryFile("w", suffix=".cjs", encoding="utf-8", dir=REPO, delete=False) as handle: @@ -933,5 +938,10 @@ console.log(JSON.stringify({ initial, hiddenStates, afterCustom, afterSelect, su "selectValue": "openrouter/beta", } assert out["submitValue"] == "vendor/final-model" + assert out["afterWhitespaceClear"] == { + "model": "openrouter/beta", + "selectedIndex": 2, + "selectValue": "openrouter/beta", + } assert out["whitespaceSubmitValue"] == "openrouter/beta" assert out["whitespaceCustomValue"] == ""