Fixing requesting items multiple times on scroll on mobile

This commit is contained in:
subnub
2020-05-15 04:10:43 -04:00
parent 37022ec391
commit 93f18e22e6
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -6,6 +6,7 @@ import {startSetStorage} from "./storage"
import uuid from "uuid";
import axios from "axios";
import env from "../enviroment/envFrontEnd";
import mobileCheck from "../utils/mobileCheck";
const http = require('http');
const https = require('https');
@@ -87,6 +88,10 @@ export const startLoadMoreFiles = (parent="/", sortby="DEFAULT", search="", star
}
dispatch(loadMoreFiles(results.data))
if (mobileCheck()) {
dispatch(setLoading(false));
}
}).catch((err) => {
console.log(err)
+2
View File
@@ -1,6 +1,7 @@
import {startLoadMoreFiles} from "../../actions/files";
import {startSetSelectedItem, setLastSelected} from "../../actions/selectedItem";
import {setLoading} from "../../actions/main";
import {setPopupFile} from "../../actions/popupFile";
import mobileCheck from "../../utils/mobileCheck"
import MainSection from "./MainSection";
@@ -79,6 +80,7 @@ class MainSectionContainer extends React.Component {
const lastFileDate = this.props.files[this.props.files.length - 1].uploadDate
const lastFileName = this.props.files[this.props.files.length - 1].filename
this.props.dispatch(setLoading(true));
this.props.dispatch(startLoadMoreFiles(parent, sortBy, search, lastFileDate, lastFileName));
}