From 93f18e22e66b297da6f37dc64fc5338708b33211 Mon Sep 17 00:00:00 2001 From: subnub Date: Fri, 15 May 2020 04:10:43 -0400 Subject: [PATCH] Fixing requesting items multiple times on scroll on mobile --- src/actions/files.js | 5 +++++ src/components/MainSection/index.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/actions/files.js b/src/actions/files.js index 8e3e452..7239a6f 100644 --- a/src/actions/files.js +++ b/src/actions/files.js @@ -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) diff --git a/src/components/MainSection/index.js b/src/components/MainSection/index.js index e487569..a32d93c 100644 --- a/src/components/MainSection/index.js +++ b/src/components/MainSection/index.js @@ -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)); }