fix(microprints): collapse expanded file when highlighting a different file

- Add test in microprints_live_test.exs that documents the uncoupled state bug
- Fix handle_event("highlight_line") to collapse expanded_path when
  highlighting a line in a different file
- All 159 tests pass
This commit is contained in:
Firehose Bot
2026-05-18 17:28:30 +01:00
parent eb97015dc0
commit 36bdc0610e
4 changed files with 74 additions and 2 deletions
@@ -105,10 +105,18 @@ defmodule FirehoseWeb.MicroprintsLive do
_ -> String.to_integer(line)
end
# Collapse any currently expanded file when highlighting a different file
expanded =
case socket.assigns.expanded_path do
^path -> socket.assigns.expanded_path
_ -> nil
end
{:noreply,
socket
|> assign(:highlighted_path, path)
|> assign(:highlighted_line, highlighted)}
|> assign(:highlighted_line, highlighted)
|> assign(:expanded_path, expanded)}
end
@impl true