Liveview diff tracking with pub/sub

Normally, yes, Diff = Current - Previous, right? The example code has temporary_assigns: [comment: nil, children: []]} so once view is rendered, and new comment is submitted, fetched_children - [] = fetched_children. (I didn’t pull the code and run debugging though that’s why you could try IO.inspect in update function there)

I’d debug both the broadcaster and the receiver. The broadcaster has children: [new_comment] on their socket, but receiver will call send_update which will call preload/1 and update/2 the first parameter (assigns) of update/2 will come from the send_update and through preload/1, and the second parameter is existing socket.assigns (at this point it should be empty [ ]), and it will merge the assigns (first parameter) into it.

Did you try debugging around the preload and update function? I won’t be sure for sure until I really pull the code down, run, and debug. Hope this helps a little more. :slight_smile: