Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop with bind:selectedValue on multi selects #247

Closed
dermetfan opened this issue Mar 30, 2021 · 2 comments
Closed

Infinite loop with bind:selectedValue on multi selects #247

dermetfan opened this issue Mar 30, 2021 · 2 comments
Labels
bug Something isn't working Fixed in v4

Comments

@dermetfan
Copy link

When I use bind:selectedValue with loadOptions, svelte-select freezes my entire application. It seems to loop infinitely.

REPL

@dermetfan dermetfan changed the title Infinite loop with bind:selectedValue and loadOptions Infinite loop with bind:selectedValue on multi selects Apr 6, 2021
@dermetfan
Copy link
Author

dermetfan commented Apr 6, 2021

Apparently it is not related to loadOptions but solely depends on whether at least one is multi. New example:

REPL

REPL code
<script>
	import Select from 'svelte-select@3.17.0';
	const complexItems = [
		{value: 'chocolate', label: 'Chocolate', group: 'Sweet'},
		{value: 'pizza', label: 'Pizza', group: 'Savory'},
		{value: 'cake', label: 'Cake', group: 'Sweet'},
		{value: 'chips', label: 'Chips', group: 'Savory'},
		{value: 'ice-cream', label: 'Ice Cream', group: 'Sweet'}
	];
	
	let selectedValue;
	$: console.log(selectedValue);
</script>

<h2>
	These <code>bind:selectedValue</code> on the same variable.<br>
	<br>
	Any <code>&lt;Select&gt;</code> which is not multi hangs on selection (if at least one is multi).
</h2>

<h2>Multi</h2>
<em>This works…</em>
<Select bind:selectedValue items={complexItems} isMulti={true}></Select>

<h2>Single</h2>
<em>…but this hangs/loops infinitely on selection</em>
<Select bind:selectedValue items={complexItems}></Select>

@rob-balfre rob-balfre added bug Something isn't working Fixed in v4 labels Jun 28, 2021
@mrHaugen
Copy link

mrHaugen commented Nov 3, 2021

When I use bind:selectedValue the entire application freezes if I reload the page.

4.0.0-beta.6 is working fine.
4.0.0-beta-7 and later versions seem to have this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed in v4
Projects
None yet
Development

No branches or pull requests

3 participants