Skip to content

Commit 05320d6

Browse files
authored
fix: Liveview setup fails outside test environment (#88)
Fixes #87
1 parent f154cac commit 05320d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/phoenix/sync/live_view.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ if Code.ensure_loaded?(Phoenix.Component) do
209209
if Phoenix.LiveView.connected?(socket) do
210210
client =
211211
Keyword.get_lazy(electric_opts, :client, fn ->
212-
get_in(socket.private[:connect_info].private[:electric_client]) ||
213-
Phoenix.Sync.client!()
212+
case socket.private[:connect_info] do
213+
%{private: %{electric_client: client}} -> client
214+
_ -> Phoenix.Sync.client!()
215+
end
214216
end)
215217

216218
Phoenix.LiveView.stream(

0 commit comments

Comments
 (0)