Skip to content

Commit

Permalink
Task: Refactor - don't render trace body when traces loaded from hist…
Browse files Browse the repository at this point in the history
…orical (#182)
  • Loading branch information
hhubert6 authored Mar 10, 2025
1 parent 96d0a37 commit a610c57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/live_debugger/live_components/traces_list.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule LiveDebugger.LiveComponents.TracesList do
|> TracingHelper.check_fuse()
|> case do
{:ok, socket} ->
trace_display = TraceDisplay.from_live_trace(trace)
trace_display = TraceDisplay.from_trace(trace)
stream_insert(socket, :existing_traces, trace_display, at: 0, limit: @stream_limit)

{_, socket} ->
Expand Down Expand Up @@ -120,7 +120,7 @@ defmodule LiveDebugger.LiveComponents.TracesList do

@impl true
def handle_async(:fetch_existing_traces, {:ok, trace_list}, socket) do
trace_list = Enum.map(trace_list, &TraceDisplay.from_historical_trace/1)
trace_list = Enum.map(trace_list, &TraceDisplay.from_trace/1)

socket
|> assign(existing_traces_status: :ok)
Expand Down Expand Up @@ -189,7 +189,7 @@ defmodule LiveDebugger.LiveComponents.TracesList do
socket
|> stream_insert(
:existing_traces,
TraceDisplay.from_historical_trace(trace),
TraceDisplay.from_trace(trace) |> TraceDisplay.render_body(),
at: abs(trace.id),
limit: @stream_limit
)
Expand Down
6 changes: 1 addition & 5 deletions lib/live_debugger/structs/trace_display.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ defmodule LiveDebugger.Structs.TraceDisplay do
render_body?: boolean()
}

def from_historical_trace(%Trace{} = trace) do
%__MODULE__{id: trace.id, trace: trace, render_body?: true}
end

def from_live_trace(%Trace{} = trace) do
def from_trace(%Trace{} = trace) do
%__MODULE__{id: trace.id, trace: trace, render_body?: false}
end

Expand Down

0 comments on commit a610c57

Please sign in to comment.