Remember Position Inquiry for Infinite Scroll.

Thanks for helping me out, I really appreciate it :slight_smile:

Here’s what it looks like:

import {session} from 'wix-storage';

if (session.getItem("mpi") === null) {
    console.log("IS NULL");
} else {
    console.log("NOT NULL");
    console.log(session.getItem("mpi"));
    $w.onReady( () => {
        $w("#items").onReady( () => {
                let IndexPage = session.getItem("mpi");
                console.log(IndexPage);
                $w("#items").loadPage(IndexPage);
        })
    })
}

export function boxL_viewportEnter(event) {
   $w("#items").loadMore()
   .then(()=>{
      session.setItem("mpi", $w("#items").getCurrentPageIndex());

      console.log(session.getItem("mpi"))
   })
}

If the KEY (“mpi”) is NOT NULL and has a value, when returning back to page:

The Browser-Console returns and error indicating its not a “value”.


Maybe it’s treating “IndexPage” as a String instead of number?

With all that in mind,
IF instead I put a real number, then the whole process works so clearly the issue is the “IndexPage” not being treated as a number…

        $w("#items").loadPage(8)

I will keep trying but I really think it’s very close to being resolved :stuck_out_tongue:

TestPage: https://www.emunations.com/testh