Skip to content

Commit eea3271

Browse files
committed
Merge branch 'postgrest-scroll' of https://github.com/UW-Macrostrat/web-components into postgrest-scroll
2 parents c6192fe + 8c0592b commit eea3271

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/ui-components/src/postgrest-infinite-scroll.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ interface PostgRESTInfiniteScrollProps extends InfiniteScrollProps<any> {
1212
ascending?: boolean;
1313
filterable?: boolean;
1414
order_key?: string;
15-
SearchBarComponent?: React.ComponentType<{ onChange: (value: string) => void }>;
15+
SearchBarComponent?: React.ComponentType<{
16+
onChange: (value: string) => void;
17+
}>;
1618
MultiSelectComponent?: React.ComponentType<{
1719
items: string[];
1820
itemRenderer: ItemRenderer<string>;
@@ -67,16 +69,17 @@ export function PostgRESTInfiniteScrollView(
6769

6870
const defaultParams = useMemo(() => {
6971
return {
70-
[id_key]: !order_key ?
71-
operator2 + `.${initialItems?.[0]?.[id_key] ?? id}` : undefined,
72-
order: order_key ?
73-
`${order_key}.${operator1},${id_key}.${notOperator1}` : `${id_key}.${operator1}`,
72+
[id_key]: !order_key
73+
? operator2 + `.${initialItems?.[0]?.[id_key] ?? id}`
74+
: undefined,
75+
order: order_key
76+
? `${order_key}.${operator1},${id_key}.${notOperator1}`
77+
: `${id_key}.${operator1}`,
7478
limit,
7579
...Object.fromEntries(
7680
selectedItems.map((key) => [key, `ilike.*${filterValue}*`]),
7781
),
78-
or: order_key ?
79-
or : undefined,
82+
or: order_key ? or : undefined,
8083
};
8184
}, [selectedItems, filterValue]);
8285

@@ -128,7 +131,6 @@ export function PostgRESTInfiniteScrollView(
128131
}
129132
};
130133

131-
132134
const defaultHasMore = (response) => {
133135
console.log("defaultHasMore", response);
134136
return response.length === limit;
@@ -179,4 +181,4 @@ export function PostgRESTInfiniteScrollView(
179181
key: filterValue + selectedItems.join(","),
180182
}),
181183
]);
182-
}
184+
}

0 commit comments

Comments
 (0)