|
|
@@ -2,7 +2,7 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
use VaccinsWeb, :live_view
|
|
|
alias Vaccins.{LocationStore, Search}
|
|
|
|
|
|
- @refresh_period_ms 30 * 1000
|
|
|
+ @refresh_period_ms 2 * 1000
|
|
|
|
|
|
@impl true
|
|
|
def mount(_params, _session, socket) do
|
|
|
@@ -50,13 +50,16 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
{:noreply, socket |> assign(pending: pending |> Map.put(ref, id))}
|
|
|
end
|
|
|
|
|
|
- def handle_info(:periodic_refresh, socket),
|
|
|
+ def handle_info(:periodic_refresh, socket = %{assigns: %{display_cs: false}}),
|
|
|
do:
|
|
|
{:noreply,
|
|
|
socket
|
|
|
|> trigger_global_refresh
|
|
|
|> trigger_periodic_refresh}
|
|
|
|
|
|
+ def handle_info(:periodic_refresh, socket = %{assigns: %{display_cs: true}}),
|
|
|
+ do: {:noreply, socket |> trigger_periodic_refresh}
|
|
|
+
|
|
|
def handle_info({:location_has_slots, id, true}, socket) do
|
|
|
{:noreply, socket |> update(:locations_with_early_slots, &(&1 |> MapSet.put(id)))}
|
|
|
end
|