@@ -14,6 +14,7 @@ interface PostgRESTInfiniteScrollProps extends InfiniteScrollProps<any> {
1414 extraParams ?: Record < string , any > ;
1515 ascending ?: boolean ;
1616 filterable ?: boolean ;
17+ searchColumns ?: string [ ] ;
1718 order_key ?: string ;
1819 key ?: string ;
1920 toggles ?: any ;
@@ -52,6 +53,7 @@ export function PostgRESTInfiniteScrollView(
5253 extraParams = { } ,
5354 key,
5455 toggles = null ,
56+ searchColumns = undefined ,
5557 ...rest
5658 } = props ;
5759
@@ -64,7 +66,9 @@ export function PostgRESTInfiniteScrollView(
6466 const MultiSelectToUse = MultiSelectComponent ?? MultiSelect ;
6567
6668 const res = useAPIResult ( route , { limit : 1 } ) ;
67- const [ selectedItems , setSelectedItems ] = useState < string [ ] > ( [ ] ) ;
69+ const [ selectedItems , setSelectedItems ] = useState < string [ ] > (
70+ searchColumns || [ ] ,
71+ ) ;
6872 const [ filterValue , setFilterValue ] = useState < string > ( "" ) ;
6973 const operator1 = ascending ? `asc` : `desc` ;
7074 const notOperator1 = ascending ? `desc` : `asc` ;
@@ -122,9 +126,9 @@ export function PostgRESTInfiniteScrollView(
122126 return h ( Spinner ) ;
123127 }
124128
125- const keys = Object . keys ( res [ 0 ] || { } ) . filter (
126- ( key ) => typeof res [ 0 ] [ key ] === "string" ,
127- ) ;
129+ const keys =
130+ searchColumns ||
131+ Object . keys ( res [ 0 ] || { } ) . filter ( ( key ) => typeof res [ 0 ] [ key ] === "string" ) ;
128132
129133 // Filtering function
130134 const filterItem : ItemPredicate < string > = ( query , item ) =>
@@ -198,8 +202,16 @@ export function PostgRESTInfiniteScrollView(
198202 } ) ;
199203 } ;
200204
205+ const {
206+ toggles : _omitToggles ,
207+ SearchBarComponent : _omitSearchBar ,
208+ MultiSelectComponent : _omitMultiSelect ,
209+ ...cleaned
210+ } = props ;
211+
201212 const newKey =
202- key || `${ filterValue } -${ selectedItems . join ( "," ) } -${ JSON . stringify ( props ) } ` ;
213+ key ||
214+ `${ filterValue } -${ selectedItems . join ( "," ) } -${ JSON . stringify ( cleaned ) } ` ;
203215
204216 return h ( "div.postgrest-infinite-scroll" , [
205217 h ( "div.header" , [
0 commit comments