fix(1649): don't use old data on rerender when data update from provider is handled by component (#1707)
This commit is contained in:
parent
224ec8653b
commit
9dfe8789d1
@ -39,7 +39,9 @@ const AccountsManager = () => {
|
||||
update,
|
||||
variables,
|
||||
});
|
||||
dataRef.current = data;
|
||||
if (!dataRef.current && data) {
|
||||
dataRef.current = data;
|
||||
}
|
||||
const getRows = async ({
|
||||
successCallback,
|
||||
startRow,
|
||||
|
@ -43,7 +43,9 @@ export const AccountManager = ({
|
||||
update,
|
||||
variables,
|
||||
});
|
||||
dataRef.current = data;
|
||||
if (!dataRef.current && data) {
|
||||
dataRef.current = data;
|
||||
}
|
||||
const getRows = async ({
|
||||
successCallback,
|
||||
startRow,
|
||||
|
@ -84,8 +84,10 @@ export const useFillsList = ({ partyId, gridRef, scrolledToTop }: Props) => {
|
||||
(TradeEdge | null)[],
|
||||
Trade[]
|
||||
>({ dataProvider: fillsWithMarketProvider, update, insert, variables });
|
||||
totalCountRef.current = totalCount;
|
||||
dataRef.current = data;
|
||||
if (!dataRef.current && data) {
|
||||
totalCountRef.current = totalCount;
|
||||
dataRef.current = data;
|
||||
}
|
||||
|
||||
const getRows = makeInfiniteScrollGetRows<TradeEdge>(
|
||||
newRows,
|
||||
|
@ -146,7 +146,9 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
variables,
|
||||
});
|
||||
|
||||
marketDataRef.current = marketData;
|
||||
if (marketDataRef.current && marketData) {
|
||||
marketDataRef.current = marketData;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!marketData || !market || !data) {
|
||||
|
@ -84,8 +84,10 @@ export const useOrderListData = ({
|
||||
insert,
|
||||
variables,
|
||||
});
|
||||
totalCountRef.current = totalCount;
|
||||
dataRef.current = data;
|
||||
if (!dataRef.current && data) {
|
||||
totalCountRef.current = totalCount;
|
||||
dataRef.current = data;
|
||||
}
|
||||
|
||||
const getRows = makeInfiniteScrollGetRows<OrderEdge>(
|
||||
newRows,
|
||||
|
@ -58,7 +58,9 @@ export const usePositionsData = (
|
||||
update,
|
||||
variables,
|
||||
});
|
||||
dataRef.current = assetSymbol ? filter(data, { assetSymbol }) : data;
|
||||
if (!dataRef.current && data) {
|
||||
dataRef.current = assetSymbol ? filter(data, { assetSymbol }) : data;
|
||||
}
|
||||
const getRows = useCallback(
|
||||
async ({ successCallback, startRow, endRow }: GetRowsParams) => {
|
||||
const rowsThisBlock = dataRef.current
|
||||
|
@ -93,7 +93,9 @@ export const TradesContainer = ({ marketId }: TradesContainerProps) => {
|
||||
variables,
|
||||
});
|
||||
totalCountRef.current = totalCount;
|
||||
dataRef.current = data;
|
||||
if (!dataRef.current && data) {
|
||||
dataRef.current = data;
|
||||
}
|
||||
|
||||
const getRows = makeInfiniteScrollGetRows<TradeEdge>(
|
||||
newRows,
|
||||
|
Loading…
Reference in New Issue
Block a user