fix: Preserve station-specific URLs when updating map state
- Fix URL persistence for station routes (e.g., /w5isp) - Update handle_url_update to maintain callsign in path - Modify tracking events to use consistent URL structure - Prevent unwanted redirects from /callsign to / URLs now correctly persist as /w5isp?lat=...&lng=...&z=... instead of redirecting to root with query parameters. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5c69604c32
commit
24382f5993
1 changed files with 13 additions and 5 deletions
|
|
@ -403,12 +403,12 @@ defmodule AprsmeWeb.MapLive.Index do
|
|||
# Clear tracking
|
||||
socket
|
||||
|> assign(tracked_callsign: "")
|
||||
|> push_patch(to: "/")
|
||||
|> update_url_with_current_state()
|
||||
else
|
||||
# Set tracking
|
||||
# Set tracking and navigate to callsign URL
|
||||
socket
|
||||
|> assign(tracked_callsign: normalized_callsign)
|
||||
|> push_patch(to: "/?call=#{normalized_callsign}")
|
||||
|> push_patch(to: "/#{normalized_callsign}")
|
||||
end
|
||||
|
||||
{:noreply, socket}
|
||||
|
|
@ -419,7 +419,7 @@ defmodule AprsmeWeb.MapLive.Index do
|
|||
socket =
|
||||
socket
|
||||
|> assign(tracked_callsign: "", overlay_callsign: "")
|
||||
|> push_patch(to: "/")
|
||||
|> update_url_with_current_state()
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
|
@ -605,7 +605,15 @@ defmodule AprsmeWeb.MapLive.Index do
|
|||
do: "&hist=#{socket.assigns[:historical_hours]}",
|
||||
else: ""
|
||||
|
||||
new_path = "/?lat=#{lat}&lng=#{lng}&z=#{zoom}#{trail_param}#{hist_param}"
|
||||
# Preserve callsign in path if tracking
|
||||
base_path =
|
||||
if socket.assigns.tracked_callsign == "" do
|
||||
"/"
|
||||
else
|
||||
"/#{socket.assigns.tracked_callsign}"
|
||||
end
|
||||
|
||||
new_path = "#{base_path}?lat=#{lat}&lng=#{lng}&z=#{zoom}#{trail_param}#{hist_param}"
|
||||
Logger.debug("Updating URL to: #{new_path}")
|
||||
push_patch(socket, to: new_path, replace: true)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue