fix: fix empty rows on empty collateral list (#2312)
* fix: fix empty rows on empty collateral list * fix: fix empty rows on empty collateral list * fix: fix empty rows on empty collateral list
This commit is contained in:
parent
5531566e2f
commit
aafa3d7256
@ -1,4 +1,5 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
process.env.TZ = 'UTC';
|
||||||
export default {
|
export default {
|
||||||
displayName: 'explorer',
|
displayName: 'explorer',
|
||||||
preset: '../../jest.preset.js',
|
preset: '../../jest.preset.js',
|
||||||
|
@ -43,7 +43,7 @@ export const AccountManager = ({
|
|||||||
const rowsThisBlock = dataRef.current
|
const rowsThisBlock = dataRef.current
|
||||||
? dataRef.current.slice(startRow, endRow)
|
? dataRef.current.slice(startRow, endRow)
|
||||||
: [];
|
: [];
|
||||||
const lastRow = dataRef.current?.length ?? -1;
|
const lastRow = dataRef.current?.length ?? undefined;
|
||||||
successCallback(rowsThisBlock, lastRow);
|
successCallback(rowsThisBlock, lastRow);
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
|
@ -159,7 +159,7 @@ describe('useOrderListData Hook', () => {
|
|||||||
expect(loadMock).toHaveBeenCalled();
|
expect(loadMock).toHaveBeenCalled();
|
||||||
expect(successCallback).toHaveBeenLastCalledWith(
|
expect(successCallback).toHaveBeenLastCalledWith(
|
||||||
mockDelta.map((item) => item.node),
|
mockDelta.map((item) => item.node),
|
||||||
-1
|
undefined
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ const getLastRow = (
|
|||||||
blockLength: number,
|
blockLength: number,
|
||||||
totalCount?: number
|
totalCount?: number
|
||||||
) => {
|
) => {
|
||||||
let lastRow = -1;
|
let lastRow = undefined;
|
||||||
if (totalCount !== undefined) {
|
if (totalCount !== undefined) {
|
||||||
if (!totalCount) {
|
if (!totalCount) {
|
||||||
lastRow = 0;
|
lastRow = 0;
|
||||||
@ -50,9 +50,15 @@ export const makeInfiniteScrollGetRows =
|
|||||||
const rowsThisBlock = data.current
|
const rowsThisBlock = data.current
|
||||||
? data.current.slice(startRow, endRow).map((edge) => edge?.node)
|
? data.current.slice(startRow, endRow).map((edge) => edge?.node)
|
||||||
: [];
|
: [];
|
||||||
const lastRow =
|
const currentLastNumber = getLastRow(
|
||||||
getLastRow(startRow, endRow, rowsThisBlock.length, totalCount.current) -
|
startRow,
|
||||||
newRows.current;
|
endRow,
|
||||||
|
rowsThisBlock.length,
|
||||||
|
totalCount.current
|
||||||
|
);
|
||||||
|
const lastRow = currentLastNumber
|
||||||
|
? currentLastNumber - newRows.current
|
||||||
|
: currentLastNumber;
|
||||||
successCallback(rowsThisBlock, lastRow);
|
successCallback(rowsThisBlock, lastRow);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
failCallback();
|
failCallback();
|
||||||
|
Loading…
Reference in New Issue
Block a user