@@ -37,8 +37,8 @@ defmodule Phoenix.Sync.Electric.ClientAdapter do
3737 end
3838
3939 # this is the server-defined shape route, so we want to only pass on the
40- # per-request/stream position params leaving the shape-definition params
41- # from the configured client.
40+ # per-request/stream position params and subset query params, leaving
41+ # the shape-definition params from the configured client.
4242 defp request ( % { shape_definition: % PredefinedShape { } = shape } = sync_client , _conn , params ) do
4343 {
4444 Client . request (
@@ -47,7 +47,8 @@ defmodule Phoenix.Sync.Electric.ClientAdapter do
4747 offset: params [ "offset" ] ,
4848 shape_handle: params [ "handle" ] ,
4949 live: live? ( params [ "live" ] ) ,
50- next_cursor: params [ "cursor" ]
50+ next_cursor: params [ "cursor" ] ,
51+ params: subset_request_params ( params )
5152 ) ,
5253 shape
5354 }
@@ -68,6 +69,9 @@ defmodule Phoenix.Sync.Electric.ClientAdapter do
6869 defp normalise_method ( method ) , do: method |> String . downcase ( ) |> String . to_atom ( )
6970 defp live? ( live ) , do: live == "true"
7071
72+ defp subset_request_params ( params ) ,
73+ do: Map . filter ( params , fn { key , _ } -> String . starts_with? ( key , "subset__" ) end )
74+
7175 defp fetch_upstream ( sync_client , conn , request , shape ) do
7276 response = make_request ( sync_client , conn , request , shape )
7377
0 commit comments