Liveview re-renders all assigns inside `for` loop, not only the ones that changed

It does diff tracking in the sense that it won’t re-render the for loop unless @data or @labels changes. If they do change, then it sends the whole block.

If you want change tracking at the individual item level, you can either use a stateful LiveComponent, or temporary assigns and phx-update. See this blog post for more details on the tradeoff: Optimising data-over-the-wire in Phoenix LiveView – The Pug Automatic.

1 Like