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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user