Skip to content

Commit ac40073

Browse files
authored
fix: Handle Electric.ShapeCache api change (#97)
1 parent 33a9af0 commit ac40073

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/phoenix/sync/sandbox/stack.ex

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if Phoenix.Sync.sandbox_enabled?() do
110110
shape_status_spec =
111111
{Electric.ShapeCache.ShapeStatus,
112112
%Electric.ShapeCache.ShapeStatus{
113-
shape_meta_table: Electric.ShapeCache.get_shape_meta_table(stack_id: stack_id)
113+
shape_meta_table: shape_meta_table(stack_id)
114114
}}
115115

116116
children = [
@@ -147,5 +147,17 @@ if Phoenix.Sync.sandbox_enabled?() do
147147

148148
Supervisor.init(children, strategy: :one_for_one)
149149
end
150+
151+
Code.ensure_loaded(Electric.ShapeCache)
152+
153+
if function_exported?(Electric.ShapeCache, :get_shape_meta_table, 1) do
154+
defp shape_meta_table(stack_id) do
155+
Electric.ShapeCache.get_shape_meta_table(stack_id: stack_id)
156+
end
157+
else
158+
defp shape_meta_table(stack_id) do
159+
Electric.ShapeCache.ShapeStatus.shape_meta_table(stack_id)
160+
end
161+
end
150162
end
151163
end

0 commit comments

Comments
 (0)