Closed jereyi closed 8 months ago
Youy provided no example code, but is your issue the same as #168?
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 3 days.
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 3 days.
We have a page where the selected value comes from query parameters but the list of options comes from a backend API call to list what the valid ones are. I think what's going on is that on first render, we take this branch:
https://github.com/mskocik/svelecte/blob/master/src/lib/Svelecte.svelte#L399-L406
and then after the list of options gets updated to include the value from the query parameter, this "is the selected option valid" logic doesn't get re-evaluated. I think we can hack around this by binding the selection to a value that doesn't get "set" until the set of options is available, but maybe there's a way Svelecte can handle this sort of thing more gracefully?
Can you provide working example? Or IF the list is provided with backend call, can't you just pass it as fetch
parameter?
When fetch
is set and there is no [query]
string in search params, url will be requested and if you have initial value, Svelecte "will wait" for options to be populated to prevent the !success
branch
@leifwalsh and @jereyi I would like to fix this in v4, but it's impossible without reproduction example. Can you provide example in REPL or in sveltelab.dev
Check in v4 if it's resolved, re-open otherwise. Thanks.
Hi,
I am encountering an issue with rendering the Svelecte component with an initial value. By adding some print statements, I discovered that the initial values passed to the component seems to be immediately overwritten with null values whenever the component is first rendered. Afterwards, it functions as expected, but it does not seem like this should be the default behavior. Could this be due to a bug with the component?
Thanks!