fix(trading): improve data count on propsed markets (#3890)

This commit is contained in:
Maciek 2023-05-23 10:53:15 +02:00 committed by GitHub
parent 06c540666e
commit 70e172045d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,12 +31,13 @@ export const ProposalsList = () => {
removePaginationWrapper(data?.proposalsConnection?.edges)
);
const { columnDefs, defaultColDef } = useColumnDefs();
useEffect(() => {
setDataCount(gridRef.current?.api?.getModel().getRowCount() ?? 0);
}, [filteredData]);
const onFilterChanged = useCallback(() => {
const handleDataCount = useCallback(() => {
setDataCount(gridRef.current?.api?.getModel().getRowCount() ?? 0);
}, []);
useEffect(() => {
handleDataCount();
}, [filteredData, handleDataCount]);
return (
<div className="relative h-full">
<AgGrid
@ -47,10 +48,11 @@ export const ProposalsList = () => {
defaultColDef={defaultColDef}
suppressLoadingOverlay
suppressNoRowsOverlay
onFilterChanged={onFilterChanged}
onFilterChanged={handleDataCount}
storeKey="proposedMarkets"
getRowId={({ data }) => data.id}
style={{ width: '100%', height: '100%' }}
onGridReady={handleDataCount}
/>
<div className="pointer-events-none absolute inset-0">
<AsyncRenderer