mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-24 08:55:14 +03:00
Revert "fixed new query data getting spliced, fixed state change logic"
This reverts commit fb4de19400
.
This commit is contained in:
parent
fb4de19400
commit
27c02e8e23
@ -1,4 +1,5 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
import { Alert } from 'react-native'
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
@ -17,6 +18,7 @@ const SideMenuContainer = ({ navigation }) => {
|
|||||||
const drawerStatus = useDrawerStatus();
|
const drawerStatus = useDrawerStatus();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const isLoggedIn = useSelector((state) => state.application.isLoggedIn);
|
const isLoggedIn = useSelector((state) => state.application.isLoggedIn);
|
||||||
const currentAccount = useSelector((state) => state.account.currentAccount);
|
const currentAccount = useSelector((state) => state.account.currentAccount);
|
||||||
const isVisibleAccountsBottomSheet = useSelector(
|
const isVisibleAccountsBottomSheet = useSelector(
|
||||||
|
@ -222,7 +222,6 @@ export const useWavesQuery = (host: string) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const _data = unionBy(...wavesQueries.map((query) => query.data), 'url');
|
const _data = unionBy(...wavesQueries.map((query) => query.data), 'url');
|
||||||
|
|
||||||
const _filteredData = useMemo(() =>
|
const _filteredData = useMemo(() =>
|
||||||
@ -237,7 +236,6 @@ export const useWavesQuery = (host: string) => {
|
|||||||
const _prevLatestWave = _filteredData[0]
|
const _prevLatestWave = _filteredData[0]
|
||||||
|
|
||||||
await _fetchPermlinks('', true);
|
await _fetchPermlinks('', true);
|
||||||
|
|
||||||
const queryResponse = await wavesQueries[0].refetch();
|
const queryResponse = await wavesQueries[0].refetch();
|
||||||
|
|
||||||
const _newData:any[] = queryResponse.data || [];
|
const _newData:any[] = queryResponse.data || [];
|
||||||
@ -249,13 +247,12 @@ export const useWavesQuery = (host: string) => {
|
|||||||
let _newWaves:any[] = []
|
let _newWaves:any[] = []
|
||||||
if (_lastIndex && _lastIndex !== 0) {
|
if (_lastIndex && _lastIndex !== 0) {
|
||||||
if (_lastIndex < 0) {
|
if (_lastIndex < 0) {
|
||||||
_newWaves = _newData?.slice(0, 5) || [];
|
_newWaves = _newData?.splice(0, 5) || [];
|
||||||
} else {
|
} else {
|
||||||
_newWaves = _newData?.slice(0, _lastIndex) || [];
|
_newWaves = _newData?.splice(0, _lastIndex) || [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return _newWaves
|
return _newWaves
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import WavesHeader from '../children/wavesHeader';
|
|||||||
import { PostTypes } from '../../../constants/postTypes';
|
import { PostTypes } from '../../../constants/postTypes';
|
||||||
import ScrollTopPopup from '../../../components/tabbedPosts/view/scrollTopPopup';
|
import ScrollTopPopup from '../../../components/tabbedPosts/view/scrollTopPopup';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import reactotron from 'reactotron-react-native';
|
|
||||||
|
|
||||||
|
|
||||||
const SCROLL_POPUP_THRESHOLD = 5000;
|
const SCROLL_POPUP_THRESHOLD = 5000;
|
||||||
@ -40,13 +39,14 @@ const WavesScreen = () => {
|
|||||||
|
|
||||||
//actions
|
//actions
|
||||||
const _handleAppStateChange = async (nextAppState) => {
|
const _handleAppStateChange = async (nextAppState) => {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
appState.current.match(/inactive|background/) &&
|
appState.current.match(/inactive|background/) &&
|
||||||
nextAppState === 'active'
|
nextAppState === 'active' &&
|
||||||
|
wavesQuery.data.length > 0
|
||||||
) {
|
) {
|
||||||
const latestWaves = await wavesQuery.latestWavesFetch()
|
const latestWaves = await wavesQuery.latestWavesFetch()
|
||||||
if (latestWaves.length > 0) {
|
if (latestWaves.length > 0) {
|
||||||
|
Alert.alert("latest waves: " + latestWaves.length);
|
||||||
setPopupAvatars(latestWaves.map((item) => item.avatar))
|
setPopupAvatars(latestWaves.map((item) => item.avatar))
|
||||||
setEnableScrollTop(true)
|
setEnableScrollTop(true)
|
||||||
}
|
}
|
||||||
@ -68,7 +68,6 @@ const WavesScreen = () => {
|
|||||||
if (postsListRef.current) {
|
if (postsListRef.current) {
|
||||||
postsListRef.current.scrollToOffset({ offset: 0 });
|
postsListRef.current.scrollToOffset({ offset: 0 });
|
||||||
setEnableScrollTop(false);
|
setEnableScrollTop(false);
|
||||||
setPopupAvatars([])
|
|
||||||
scrollPopupDebouce.cancel();
|
scrollPopupDebouce.cancel();
|
||||||
blockPopupRef.current = true;
|
blockPopupRef.current = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user