From b563e64e04c65d677a4209556d9627d2271e6727 Mon Sep 17 00:00:00 2001 From: nelsonic Date: Thu, 14 Jul 2022 01:02:01 +0100 Subject: [PATCH] dont do this https://youtu.be/p8QWtNqQYlE --- lib/app_web/live/app_live.ex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/app_web/live/app_live.ex b/lib/app_web/live/app_live.ex index ce3f7ad7..628b6519 100644 --- a/lib/app_web/live/app_live.ex +++ b/lib/app_web/live/app_live.ex @@ -74,6 +74,16 @@ defmodule AppWeb.AppLive do {:noreply, assign(socket, items: items, timer: timer)} end + @impl true + def handle_info(%{event: "update", payload: %{items: items, timer: timer}}, socket) do + {:noreply, assign(socket, items: items, timer: timer)} + end + + @impl true + def handle_info(%{event: "delete", payload: %{items: items, timer: timer}}, socket) do + {:noreply, assign(socket, items: items, timer: timer)} + end + # helper function that checks for status 4 (:done) def done?(item) do not is_nil(item.status_code) and item.status_code == 4