From 6a74fd7c34fbe3037501a888d24a809d6e3aba54 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 28 Sep 2023 00:28:26 +0500 Subject: [PATCH] Revert "fetching and checking for new waves compared to existing data" This reverts commit 0880a64dd20aca834f7f457b059c834d7ca11f69. --- .../queries/postQueries/wavesQueries.ts | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/providers/queries/postQueries/wavesQueries.ts b/src/providers/queries/postQueries/wavesQueries.ts index 592f8d39c..4db247ab5 100644 --- a/src/providers/queries/postQueries/wavesQueries.ts +++ b/src/providers/queries/postQueries/wavesQueries.ts @@ -221,48 +221,17 @@ export const useWavesQuery = (host: string) => { - const _data = unionBy(...wavesQueries.map((query) => query.data), 'url'); const _filteredData = useMemo(() => - _data.filter(post => isArray(mutes) ? mutes.indexOf(post?.author) < 0 : true), - [mutes, _data]) - - - - - const _lastestWavesFetch = async () => { - - const _prevLatestWave = _filteredData[0] - - await _fetchPermlinks('', true); - const queryResponse = await wavesQueries[0].refetch(); - - const _newData:any[] = queryResponse.data || []; - - //check if new waves are available - const _lastIndex = _newData?.findIndex(item => - ( item.author + item.permlink === _prevLatestWave.author + _prevLatestWave.permlink)); - - let _newWaves:any[] = [] - if (_lastIndex && _lastIndex !== 0) { - if (_lastIndex < 0) { - _newWaves = _newData?.splice(0, 5) || []; - } else { - _newWaves = _newData?.splice(0, _lastIndex) || []; - } - } - - return _newWaves - } - + _data.filter(post => isArray(mutes) ? mutes.indexOf(post?.author) < 0 : true), + [mutes, _data]) return { data: _filteredData, isRefreshing, isLoading: isLoading || wavesQueries.lastItem?.isLoading || wavesQueries.lastItem?.isFetching, fetchNextPage: _fetchNextPage, - latestWavesFetch: _lastestWavesFetch, refresh: _refresh, }; };