Combobox, reactivity and automatic item selections #2227
Unanswered
silktrader
asked this question in
Help
Replies: 1 comment
-
For the record, I seem to be able to get the desired result by ignoring
let commandInputValue = $state('');
$effect( () => {
// Clear any previous debounce timeout
clearTimeout(debounceTimeout);
// Set a new timeout
debounceTimeout = setTimeout(async () => {
await getHints(commandInputValue);
}, 600);
console.log(commandInputValue);
}); ... but I still don't understand what failed in the first code excerpt. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am having a issue with the ComboBox component: although the Command.Items are properly rendered and populated from my API fetches, the first item in the list gets automatically selected on navigating with the keyboard, or mouse.
I am triggering updates to my source array from "onStateChange" (and caching results in my service).
Please, note that "shouldFilter" is set to "false".
These is the content of "state.filtered.items", after one fetch:
Only entry 2 and 3 are present in my reactive array.
Do you have any idea why "state.value" resets to the first item, after navigating with the keyboard (or mouse) to the successive ones, and why the first item becomes automatically highlighted and selected?
If I click explicitly on the item, the "selectedValue" is set as desired.
This is my
+page.svelte
:Beta Was this translation helpful? Give feedback.
All reactions