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

filtering with store value doesn't trigger re-render #2693

Closed
janwillemtulp opened this issue May 6, 2019 · 1 comment · Fixed by #3147
Closed

filtering with store value doesn't trigger re-render #2693

janwillemtulp opened this issue May 6, 2019 · 1 comment · Fixed by #3147
Labels

Comments

@janwillemtulp
Copy link

When filtering a list using a store value, it doesn't trigger a re-render if the filtering is done inline in an expression. It does trigger a re-render if you create a reactive variable first.

This does not trigger a re-render of the code inside the each block if $selectedItem is updated:
{#each $list.filter(d => d === $selectedItem) as item}

But first declaring this...
$: filteredList = $list.filter(d => d === $selectedItem) as item}
... and then ...
{#each filteredList as item}
... does re-render the each block when the $selectedItem is updated.

I would expect in the latter case that a re-render would be triggered as well, since $selectedItem is updated

See the example in the REPL for the mentioned behavior: https://svelte.dev/repl/57a0f818a94642ea8413a6372b6ecc38?version=3.2.0

Using Svelte v3.2.0

@Conduitry Conduitry added the bug label May 6, 2019
Rich-Harris added a commit that referenced this issue Jul 1, 2019
distinguish between lazy and non-lazy expressions
@Rich-Harris
Copy link
Member

This was a bad bug 😬 fixed in 3.6.3, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants