Skip to content

Commit

Permalink
Task: Add spinner when loading event body in collapsible (#177)
Browse files Browse the repository at this point in the history
* add spinner when trace not loaded

* add bigger messages to side example in dev
  • Loading branch information
GuzekAlan authored Mar 10, 2025
1 parent c267ff9 commit 40e05cf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dev/live_views/side.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule LiveDebuggerDev.LiveViews.Side do
Task.start(fn ->
for _ <- 1..100_000 do
Process.sleep(8)
send(current_pid, :hello)
send(current_pid, very_big_message())
end
end)

Expand All @@ -25,7 +25,26 @@ defmodule LiveDebuggerDev.LiveViews.Side do
"""
end

def handle_info(:hello, socket) do
def handle_info(_, socket) do
{:noreply, socket}
end

defp very_big_message() do
part = %{
list: [1, 2, 3, 4],
map: %{a: 1, b: 2},
keyword: [a: 1, b: 2],
tuple: {1, 2},
string: "string",
atom: :some_atom,
number: 42.12,
boolean: true,
nil: nil,
pid: self()
}

Enum.reduce(1..100, %{}, fn i, acc ->
Map.put(acc, i, part)
end)
end
end
4 changes: 4 additions & 0 deletions lib/live_debugger/live_components/traces_list.ex
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ defmodule LiveDebugger.LiveComponents.TracesList do
level={1}
/>
<% end %>
<% else %>
<div class="w-full flex items-center justify-center">
<.spinner size="sm" />
</div>
<% end %>
</div>
</.collapsible>
Expand Down

0 comments on commit 40e05cf

Please sign in to comment.