fix(#4706): keep onboarding picker state aligned after custom clear
This commit is contained in:
parent
d0eb9b57df
commit
88911448ff
3 changed files with 14 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"] == ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue