Code Monkey home page Code Monkey logo

Comments (3)

HRworksVid avatar HRworksVid commented on June 2, 2024

@piecyk Works, thanks. One question: It seems like I have abused the old functionality for my initial lazy loading to work and I want to know if this is intentional.

The infinite scroll example suggests setting allRows.length + 1 as count for lazy loading. I used this behavior for showing a loading animation when initially loading elements (initially allRows.length is 0), knowing that the last / only item in the list is the 'loading' item. Now that no items are returned, I cannot identify a loading item anymore, also the getTotalSize() returns 0.

I got a few workarounds for this to work for me, might as well move to TanStack Query but I wanted to make sure this current behavior is intentional. I can provide a Codesandbox if necessary

from virtual.

piecyk avatar piecyk commented on June 2, 2024

@HRworksVid i would say that it's expected, as we should not return rows when there is no content, the above example is working fine for me. I think you are trying to render conditionally and want to trigger the call before the scroll element is mounted?

Overall my current approach regarding infinite scroll is using IntersectionObserver to call next request, https://codesandbox.io/p/sandbox/focused-http-d2kyky as imho it's kinda simpler.

from virtual.

HRworksVid avatar HRworksVid commented on June 2, 2024

Hey @piecyk, that's an interesting approach. I used the one from the infinite scroll example, here you can see it working with beta61: https://codesandbox.io/p/sandbox/rough-dawn-p3tk7g

Would it be better to use this one or the other? Might as well update the example in the docs maybe?

from virtual.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.