Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Infinite scroll to work seems to stop at loadhorizon value? #39

Open
mattdwardle opened this issue Aug 16, 2017 · 1 comment

Comments

@mattdwardle
Copy link

Here is a snippet from my setupImpagination function. This stopped when the page offset was 14. Thanks

    setupImpagination() {
        let _this = this;
        let dataset = new Dataset({
            pageSize: 4,
            loadHorizon: 10,
            // pageOffset: this.state.pageOffset,
            // Anytime there's a new state emitted, we want to set that on
            // the componets local state.
            observe: (datasetState) => {
                this.setState({ datasetState });
            },

            // Where to fetch the data from.
            fetch(pageOffset, pageSize, stats) {
                console.log('page offset - ' + pageOffset);
                console.log('page size - ' + pageSize);
                var URL = 'https://example.com/wp-json/custom/v1/article_video_callback/?page=' + pageOffset + '&per_page=' + pageSize;
                return fetch(URL)
                    .then(response => response.json())
                    .catch((error) => {
                        console.error(error);
                    });
            }
        });

        // Set the readOffset to the first record in the state
        dataset.setReadOffset(0);
        this.setState({ dataset });        
    }
@cowboyd
Copy link
Contributor

cowboyd commented Oct 30, 2017

@mattdwardle Can you post the content of the console?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants