# InfiniteScroll bug or problem

**URL:** <https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356>\
**Category:** ionic-v3\
**Created:** [August 1, 2017, 8:04am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356 "2017-08-01T08:04:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![agrupalo](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@agrupalo](https://forum.ionicframework.com/u/agrupalo)\
**Post date:** [August 1, 2017, 8:04am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/1 "2017-08-01T08:04:43Z")

</div>

Im getting errors in any page im using InfiniteScroll

This is the error that ionic is giving me

```auto
Uncaught TypeError: Cannot read property 'timeStamp' of null
    at InfiniteScroll._onScroll (main.js:61600)
    at SafeSubscriber.schedulerFn [as _next] (main.js:4216)
    at SafeSubscriber.__tryOrUnsub (main.js:43527)
    at SafeSubscriber.next (main.js:43474)
    at Subscriber._next (main.js:43414)
    at Subscriber.next (main.js:43378)
    at EventEmitterProxy.Subject.next (main.js:47145)
    at EventEmitterProxy.EventEmitter.emit (main.js:4190)
    at ScrollView.scroll.onScroll (main.js:38559)
    at ScrollView.setScrolling (main.js:95286)

```

Current Ionic Info

```auto
global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI : 7.0.1
    Ionic CLI : 3.4.0

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms : android 6.2.3
    Ionic Framework : ionic-angular 3.4.2

System:

    Node : v6.10.2
    OS : Windows 10
    Xcode : not installed
    ios-deploy : not installed
    ios-sim : not installed
    npm : 3.10.10

```

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 1, 2017, 9:33am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/2 "2017-08-01T09:33:14Z")

</div>

What is the code you are trying to use?

---

<div class="post-metadata">

**Author:** ![Arunpkumar1991](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@Arunpkumar1991](https://forum.ionicframework.com/u/Arunpkumar1991)\
**Post date:** [August 9, 2017, 6:12am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/3 "2017-08-09T06:12:12Z")

</div>

@agrupalo  
that the bug actually when you add scrolltotop() in infinite scroll.I am also facing the same issue

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 10, 2017, 8:32pm UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/4 "2017-08-10T20:32:43Z")

</div>

Here is a Github issue about this:

> <https://github.com/ionic-team/ionic/issues/12309>

  
Add your +1

There might also be a solution.

---

<div class="post-metadata">

**Author:** ![Arunpkumar1991](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@Arunpkumar1991](https://forum.ionicframework.com/u/Arunpkumar1991)\
**Post date:** [August 11, 2017, 5:55am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/5 "2017-08-11T05:55:02Z")

</div>

thanks @Sujan12 for your help. But its very hard to find a solution . Is there any alternative for scrollToTop().Cant spend much time on this has been sitting over it for more than 3 days. If someone could then it will be a great!!!

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 11, 2017, 12:44pm UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/6 "2017-08-11T12:44:33Z")

</div>

There are multiple PRs at [https://github.com/ionic-team/ionic/pulls](https://github.com/ionic-team/ionic/pulls) for InfiniteScroll - maybe one fixes this.

---

<div class="post-metadata">

**Author:** ![Zizazorro](https://avatars.discourse-cdn.com/v4/letter/z/0ea827/32.png) [@Zizazorro](https://forum.ionicframework.com/u/Zizazorro)\
**Post date:** [November 26, 2018, 12:55pm UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/7 "2018-11-26T12:55:07Z")

</div>

The error is due to:

```auto
 if (this._lastCheck + 32 > ev.timeStamp) {
            // no need to check less than every XXms
            return 2;
        }
        this._lastCheck = ev.timeStamp;

```

You can fix it by changing this part of the code in your node\_modules, but ofcourse that is not a good solution.

I fixed it via a setTimeout():

```auto
  scrollToTopEnabled: boolean = true;

  scrollToTop() {
    if(this.scrollToTopEnabled) {
      this.scrollToTopEnabled = false;
      this.content.scrollToTop()

      setTimeout(() => {
        this.scrollToTopEnabled = true;
      }, 500)
    }
  }

```

This way the function can never be called within 32 milliseconds and the error will not be fired again

---

<div class="post-metadata">

**Author:** ![sreeragsp](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sreeragsp](https://forum.ionicframework.com/u/sreeragsp)\
**Post date:** [June 7, 2019, 5:33am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/8 "2019-06-07T05:33:09Z")

</div>

i had this issue when i used a manual scrolling in my .ts page.that is “content.scrolltop”…something like that. my best guess is that that too condradicts and cause the same issue.finally i used css for the same scrolling effect[try this link…it helps.](https://forum.ionicframework.com/t/ionic-scroll-bottom/45041/25)

---

<div class="post-metadata">

**Author:** ![danieldugger](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@danieldugger](https://forum.ionicframework.com/u/danieldugger)\
**Post date:** [June 7, 2019, 11:08am UTC](https://forum.ionicframework.com/t/infinitescroll-bug-or-problem/100356/9 "2019-06-07T11:08:15Z")

</div>

Have you tried using Angular CDK? Mike with Ionic tweeted about it. I believe they are recommending its use.
