diff --git a/src/components/sideMenu/container/sideMenuContainer.tsx b/src/components/sideMenu/container/sideMenuContainer.tsx index f6e4c9961..4edb1cc82 100644 --- a/src/components/sideMenu/container/sideMenuContainer.tsx +++ b/src/components/sideMenu/container/sideMenuContainer.tsx @@ -1,5 +1,4 @@ import React, { useEffect } from 'react'; -import { Alert } from 'react-native' import { useDispatch, useSelector } from 'react-redux'; // Actions @@ -18,7 +17,6 @@ const SideMenuContainer = ({ navigation }) => { const drawerStatus = useDrawerStatus(); - const isLoggedIn = useSelector((state) => state.application.isLoggedIn); const currentAccount = useSelector((state) => state.account.currentAccount); const isVisibleAccountsBottomSheet = useSelector( diff --git a/src/providers/queries/postQueries/wavesQueries.ts b/src/providers/queries/postQueries/wavesQueries.ts index 592f8d39c..3ce8f242f 100644 --- a/src/providers/queries/postQueries/wavesQueries.ts +++ b/src/providers/queries/postQueries/wavesQueries.ts @@ -222,6 +222,7 @@ export const useWavesQuery = (host: string) => { + const _data = unionBy(...wavesQueries.map((query) => query.data), 'url'); const _filteredData = useMemo(() => @@ -236,6 +237,7 @@ export const useWavesQuery = (host: string) => { const _prevLatestWave = _filteredData[0] await _fetchPermlinks('', true); + const queryResponse = await wavesQueries[0].refetch(); const _newData:any[] = queryResponse.data || []; @@ -247,12 +249,13 @@ export const useWavesQuery = (host: string) => { let _newWaves:any[] = [] if (_lastIndex && _lastIndex !== 0) { if (_lastIndex < 0) { - _newWaves = _newData?.splice(0, 5) || []; + _newWaves = _newData?.slice(0, 5) || []; } else { - _newWaves = _newData?.splice(0, _lastIndex) || []; + _newWaves = _newData?.slice(0, _lastIndex) || []; } } + return _newWaves } diff --git a/src/screens/waves/screen/wavesScreen.tsx b/src/screens/waves/screen/wavesScreen.tsx index 2fb8e35c4..d9f6b7ae0 100644 --- a/src/screens/waves/screen/wavesScreen.tsx +++ b/src/screens/waves/screen/wavesScreen.tsx @@ -8,6 +8,7 @@ import WavesHeader from '../children/wavesHeader'; import { PostTypes } from '../../../constants/postTypes'; import ScrollTopPopup from '../../../components/tabbedPosts/view/scrollTopPopup'; import { debounce } from 'lodash'; +import reactotron from 'reactotron-react-native'; const SCROLL_POPUP_THRESHOLD = 5000; @@ -39,14 +40,13 @@ const WavesScreen = () => { //actions const _handleAppStateChange = async (nextAppState) => { + if ( appState.current.match(/inactive|background/) && - nextAppState === 'active' && - wavesQuery.data.length > 0 + nextAppState === 'active' ) { const latestWaves = await wavesQuery.latestWavesFetch() if (latestWaves.length > 0) { - Alert.alert("latest waves: " + latestWaves.length); setPopupAvatars(latestWaves.map((item) => item.avatar)) setEnableScrollTop(true) } @@ -68,6 +68,7 @@ const WavesScreen = () => { if (postsListRef.current) { postsListRef.current.scrollToOffset({ offset: 0 }); setEnableScrollTop(false); + setPopupAvatars([]) scrollPopupDebouce.cancel(); blockPopupRef.current = true; setTimeout(() => {