Skip to content

Commit cc08726

Browse files
authored
Bug: Fix sending events from browser (#853)
* Fix sending events from browser * Fix e2e assigns_test * Update assets
1 parent c18cc91 commit cc08726

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

assets/app/hooks/fullscreen.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ const Fullscreen = {
1010
this.el.close();
1111
this.el.classList.remove('flex');
1212
this.el.classList.add('hidden');
13-
this.pushEvent('fullscreen-closed', { id: this.el.id });
13+
14+
if (this.el.hasAttribute('data-send-close-event')) {
15+
this.pushEvent('fullscreen-closed', { id: this.el.id });
16+
}
1417
};
1518

1619
// Events from the browser

lib/live_debugger/app/debugger/node_state/web/hook_components/assigns_history.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ defmodule LiveDebugger.App.Debugger.NodeState.Web.HookComponents.AssignsHistory
4141
assigns = assign(assigns, id: @assigns_history_id)
4242

4343
~H"""
44-
<.fullscreen id={@id} title="Assigns History" class="xl:w-3/4!">
44+
<.fullscreen id={@id} title="Assigns History" send_close_event={true} class="xl:w-3/4!">
4545
<div class="flex flex-col justify-between p-4 min-h-[40rem]">
4646
<.async_result :let={history_entries} assign={@history_entries}>
4747
<:loading>

lib/live_debugger/app/web/components.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ defmodule LiveDebugger.App.Web.Components do
470470
attr(:id, :string, required: true)
471471
attr(:title, :string, default: "", doc: "Title of the fullscreen.")
472472

473+
attr(:send_close_event, :boolean,
474+
default: false,
475+
doc:
476+
"Whether to send a `fullscreen-closed` event to the server when the fullscreen is closed."
477+
)
478+
473479
attr(:class, :any,
474480
default: nil,
475481
doc: "Additional classes to be added to the fullscreen element."
@@ -483,6 +489,7 @@ defmodule LiveDebugger.App.Web.Components do
483489
<dialog
484490
id={@id}
485491
phx-hook="Fullscreen"
492+
data-send-close-event={@send_close_event}
486493
class={[
487494
"relative h-max w-full xl:w-max xl:min-w-[50rem] bg-surface-0-bg pt-1 overflow-auto hidden flex-col rounded-md backdrop:bg-black backdrop:opacity-50"
488495
| List.wrap(@class)

priv/static/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

priv/static/app.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/assigns_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
defmodule LiveDebugger.E2E.AssignsTest do
22
use LiveDebugger.E2ECase
33

4+
setup_all do
5+
LiveDebugger.Services.CallbackTracer.GenServers.TracingManager.ping!()
6+
LiveDebugger.API.SettingsStorage.save(:tracing_enabled_on_start, false)
7+
8+
:ok
9+
end
10+
411
@sessions 2
512
feature "user can search assigns using the searchbar", %{
613
sessions: [dev_app, debugger]

0 commit comments

Comments
 (0)