fix historical call load
This commit is contained in:
parent
4c4b4ac2e0
commit
31d4719bcf
1 changed files with 15 additions and 3 deletions
|
|
@ -55,14 +55,16 @@ defmodule AprsWeb.MapLive.CallsignView do
|
||||||
# Pending geolocation to zoom to after map is ready
|
# Pending geolocation to zoom to after map is ready
|
||||||
pending_geolocation: nil,
|
pending_geolocation: nil,
|
||||||
# Last known position for auto-zoom
|
# Last known position for auto-zoom
|
||||||
last_known_position: nil
|
last_known_position: nil,
|
||||||
|
# Flag to track if packets have been loaded
|
||||||
|
packets_loaded: false
|
||||||
)
|
)
|
||||||
|
|
||||||
if connected?(socket) do
|
if connected?(socket) do
|
||||||
Endpoint.subscribe("aprs_messages")
|
Endpoint.subscribe("aprs_messages")
|
||||||
|
|
||||||
# Load recent packets for this callsign
|
# Don't load packets here - wait for map_ready event
|
||||||
socket = load_callsign_packets(socket, normalized_callsign)
|
# socket = load_callsign_packets(socket, normalized_callsign)
|
||||||
|
|
||||||
# Schedule regular cleanup of old packets from the map
|
# Schedule regular cleanup of old packets from the map
|
||||||
Process.send_after(self(), :cleanup_old_packets, 60_000)
|
Process.send_after(self(), :cleanup_old_packets, 60_000)
|
||||||
|
|
@ -141,6 +143,16 @@ defmodule AprsWeb.MapLive.CallsignView do
|
||||||
def handle_event("map_ready", _params, socket) do
|
def handle_event("map_ready", _params, socket) do
|
||||||
socket = assign(socket, map_ready: true)
|
socket = assign(socket, map_ready: true)
|
||||||
|
|
||||||
|
# Load callsign packets now that the map is ready
|
||||||
|
socket =
|
||||||
|
if socket.assigns.packets_loaded do
|
||||||
|
socket
|
||||||
|
else
|
||||||
|
socket
|
||||||
|
|> load_callsign_packets(socket.assigns.callsign)
|
||||||
|
|> assign(packets_loaded: true)
|
||||||
|
end
|
||||||
|
|
||||||
# Auto-start replay if it hasn't been started yet
|
# Auto-start replay if it hasn't been started yet
|
||||||
socket =
|
socket =
|
||||||
if socket.assigns.replay_started do
|
if socket.assigns.replay_started do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue