svelte: re-render just an item in list, not all the list items
See original GitHub issueComing from svelte-apollo
(a project that seems abandoned (no recrimination, everyone takes their time as they can), I would like to avoid the same fate for @urql/svelte
that I want to use in my next projects) I can see here a similar issue.
Reproduction steps:
-
go to REPL: https://codesandbox.io/s/urql-svelte-list-rerendering-uwsvn
-
click a button
-
every button re-render; so the entire list re-render itself
-
I expect re-render only the button I clicked
Same problem for svelte-apollo
here: https://github.com/timhall/svelte-apollo/issues/19
I know this can be something we have to fix in our application using a solution like:
const data = query(client, {
query: SOME_QUERY,
});
let resultData = []
$: $data.then(data => resultData = data.data.queryResult)
but this solution as you can see is very cumbersome as the project grows.
What do you think about?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (12 by maintainers)
Top Results From Across the Web
svelte: re-render just an item in list, not all the list items #704
go to REPL: https://codesandbox.io/s/urql-svelte-list-rerendering-uwsvn. click a button. every button re-render; so the entire list re-render ...
Read more >Svelte, only re-render an item in list, not the entire list
go to REPL: https://codesandbox.io/s/urql-svelte-list-rerendering-uwsvn. click a button. every button re-render; so the entire list re-render ...
Read more >Reactivity / Updating arrays and objects • Svelte Tutorial
Svelte's reactivity is triggered by assignments. Methods that mutate arrays or objects will not trigger updates by themselves. In this example, clicking the...
Read more >Rendering a list of Vue components - Learn web development
First we need to get an array of to-do items. To do that, we'll add a data property to the App.vue component object,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, everything is clear to me.
You are an angel, @kitten.
Just one last thing:
If Chrome is not re-painting the others todos (no green color on them) does it mean it’s capable of understand what is changed and what not, right?
And this Chrome feature (no-repainting) helps us with performance, right?
You angel, thanks.