Skip to content

Commit 1f49a43

Browse files
srzeszutkraleppa
andauthored
Chore: Bump required liveview version to v1.1.7 (#974)
* remove old process api * adjust for 1.1 telemetry * remove versions.ex * update workflow mix.lock * format * remove unused api * update deps * cr suggestions * replace backward-compatibility with matrix * Remove alias * fix formatting * update mix.lock * Bump required version of LiveView to 1.1.7 * Change phoenix to 1.7.0 in backward compatibility test --------- Co-authored-by: Krzysztof Nalepa <56135216+kraleppa@users.noreply.github.com> Co-authored-by: kraleppa <krzysztof.nalepa@swmansion.com>
1 parent 5ea3853 commit 1f49a43

26 files changed

Lines changed: 95 additions & 642 deletions

File tree

.github/workflows/assets/mix.lock

Lines changed: 23 additions & 31 deletions
Large diffs are not rendered by default.

.github/workflows/backward-compatibility-ci.yaml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/workflows/elixir-ci.yaml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@ concurrency:
2323

2424
jobs:
2525
build:
26-
name: Build and test
26+
name: Build and test (Elixir ${{ matrix.elixir-version }})
2727
runs-on: ubuntu-24.04
2828

29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- elixir-version: "1.19.1"
34+
otp-version: "28.1.1"
35+
backward-compatibility: false
36+
37+
- elixir-version: "1.16.0"
38+
otp-version: "26.0.2"
39+
backward-compatibility: true
40+
2941
steps:
3042
- uses: actions/checkout@v4
3143

@@ -35,17 +47,21 @@ jobs:
3547
- name: Set up Elixir
3648
uses: erlef/setup-beam@v1.20.4
3749
with:
38-
elixir-version: "1.19.1" # [Required] Define the Elixir version
39-
otp-version: "28.1.1" # [Required] Define the Erlang/OTP version
50+
elixir-version: ${{ matrix.elixir-version }}
51+
otp-version: ${{ matrix.otp-version }}
52+
53+
- name: Copy mix.lock for backward compatibility
54+
if: ${{ matrix.backward-compatibility }}
55+
run: cp ./.github/workflows/assets/mix.lock mix.lock
4056

4157
- name: Cache Mix
4258
uses: actions/cache@v4
4359
with:
4460
path: |
4561
deps
4662
_build
47-
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
48-
restore-keys: ${{ runner.os }}-mix-
63+
key: ${{ runner.os }}-mix-${{ matrix.elixir-version }}-${{ matrix.otp-version }}-${{ hashFiles('**/mix.lock') }}
64+
restore-keys: ${{ runner.os }}-mix-${{ matrix.elixir-version }}-${{ matrix.otp-version }}-
4965

5066
- name: Install Dependencies
5167
run: mix deps.get

lib/live_debugger/api/live_view_debug.ex

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -50,75 +50,11 @@ defmodule LiveDebugger.API.LiveViewDebug do
5050
@moduledoc false
5151
@behaviour LiveDebugger.API.LiveViewDebug
5252

53-
if LiveDebugger.API.System.Module.loaded?(Phoenix.LiveView.Debug) do
54-
@impl true
55-
defdelegate list_liveviews(), to: Phoenix.LiveView.Debug
56-
@impl true
57-
defdelegate socket(pid), to: Phoenix.LiveView.Debug
58-
@impl true
59-
defdelegate live_components(pid), to: Phoenix.LiveView.Debug
60-
else
61-
alias LiveDebugger.API.System.Process, as: ProcessAPI
62-
63-
@impl true
64-
def list_liveviews() do
65-
ProcessAPI.list()
66-
|> Enum.filter(&liveview?/1)
67-
|> Enum.map(fn pid ->
68-
case ProcessAPI.state(pid) do
69-
{:ok, %{socket: socket, topic: topic}} ->
70-
%{
71-
pid: pid,
72-
view: socket.view,
73-
topic: topic,
74-
transport_pid: socket.transport_pid
75-
}
76-
77-
{:error, _} ->
78-
nil
79-
end
80-
end)
81-
|> Enum.reject(&is_nil/1)
82-
end
83-
84-
@impl true
85-
def socket(pid) do
86-
case ProcessAPI.state(pid) do
87-
{:ok, %{socket: %Phoenix.LiveView.Socket{} = socket}} -> {:ok, socket}
88-
_ -> {:error, :not_alive_or_not_a_liveview}
89-
end
90-
end
91-
92-
@impl true
93-
def live_components(pid) do
94-
case ProcessAPI.state(pid) do
95-
{:ok, %{components: {components, _, _}}} ->
96-
component_info =
97-
Enum.map(components, fn {cid, {mod, id, assigns, private, _prints}} ->
98-
%{
99-
id: id,
100-
cid: cid,
101-
module: mod,
102-
assigns: assigns,
103-
private: private,
104-
children_cids: private.children_cids
105-
}
106-
end)
107-
108-
{:ok, component_info}
109-
110-
_ ->
111-
{:error, :not_alive_or_not_a_liveview}
112-
end
113-
end
114-
115-
@spec liveview?(pid :: pid()) :: boolean()
116-
defp liveview?(pid) do
117-
case ProcessAPI.initial_call(pid) do
118-
{:ok, {_module, :mount, _arity}} -> true
119-
_ -> false
120-
end
121-
end
122-
end
53+
@impl true
54+
defdelegate list_liveviews(), to: Phoenix.LiveView.Debug
55+
@impl true
56+
defdelegate socket(pid), to: Phoenix.LiveView.Debug
57+
@impl true
58+
defdelegate live_components(pid), to: Phoenix.LiveView.Debug
12359
end
12460
end

lib/live_debugger/api/system/process.ex

Lines changed: 0 additions & 77 deletions
This file was deleted.

lib/live_debugger/app/debugger/callback_tracing/web/components/trace.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,7 @@ defmodule LiveDebugger.App.Debugger.CallbackTracing.Web.Components.Trace do
324324
</:header>
325325
326326
<div class="relative">
327-
<div
328-
:if={is_nil(@displayed_trace.error)}
329-
class="absolute right-4 top-0 z-10"
330-
>
327+
<div :if={is_nil(@displayed_trace.error)} class="absolute right-4 top-0 z-10">
331328
<.open_in_editor_button
332329
id={@id <> "-fullscreen"}
333330
elixir_editor={@elixir_editor}

lib/live_debugger/app/debugger/streams/stream_utils.ex

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ defmodule LiveDebugger.App.Debugger.Streams.StreamUtils do
33
Utilities for extracting Phoenix.LiveView.Stream diffs
44
from render traces and mapping them into a list of functions.
55
"""
6-
alias LiveDebugger.Utils.Versions
76

87
@type live_stream_item :: %Phoenix.LiveView.LiveStream{
98
name: atom(),
@@ -237,9 +236,5 @@ defmodule LiveDebugger.App.Debugger.Streams.StreamUtils do
237236
end)
238237
end
239238

240-
if Versions.live_view_streams_order_changed?() do
241-
defp adjust_inserts(inserts), do: Enum.reverse(inserts)
242-
else
243-
defp adjust_inserts(inserts), do: inserts
244-
end
239+
defp adjust_inserts(inserts), do: Enum.reverse(inserts)
245240
end

lib/live_debugger/app/debugger/web/debugger_live.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ defmodule LiveDebugger.App.Debugger.Web.DebuggerLive do
8989
<Navbar.garbage_collection_warning />
9090
9191
<Navbar.settings_button return_to={@url} />
92-
<span
93-
:if={@show_sidebar_icon?}
94-
class="h-5 border-r border-default-border md_ct:hidden"
95-
>
92+
<span :if={@show_sidebar_icon?} class="h-5 border-r border-default-border md_ct:hidden">
9693
</span>
9794
9895
<.nav_icon

lib/live_debugger/app/discovery/web/discovery_live.ex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ defmodule LiveDebugger.App.Discovery.Web.DiscoveryLive do
3232
~H"""
3333
<div class="h-full flex-1 min-w-[25rem] grid grid-rows-[auto_1fr]">
3434
<div>
35-
<.live_component
36-
module={TracerStatus}
37-
id="tracer-status"
38-
tracer_started?={@tracer_started?}
39-
/>
35+
<.live_component module={TracerStatus} id="tracer-status" tracer_started?={@tracer_started?} />
4036
<NavbarComponents.navbar class="flex justify-between">
4137
<NavbarComponents.live_debugger_logo />
4238
<div class="flex items-center gap-2">

lib/live_debugger/app/settings/web/settings_live.ex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ defmodule LiveDebugger.App.Settings.Web.SettingsLive do
4646
~H"""
4747
<div class="flex-1 min-w-[25rem] grid grid-rows-[auto_1fr]">
4848
<div>
49-
<.live_component
50-
module={TracerStatus}
51-
id="tracer-status"
52-
tracer_started?={@tracer_started?}
53-
/>
49+
<.live_component module={TracerStatus} id="tracer-status" tracer_started?={@tracer_started?} />
5450
<NavbarComponents.navbar class="flex pl-2 justify-between">
5551
<div class="flex items-center gap-2">
5652
<NavbarComponents.return_link return_link={@return_to || RoutesHelper.discovery()} />

0 commit comments

Comments
 (0)