Attempting to use RTKQuery for infinite scrolling list #4733
              
                Unanswered
              
          
                  
                    
                      acolchagoff
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 3 replies
-
| The approach you've got there is an admittedly hacky and not good way of implementing infinite queries. We've got a draft PR over at #4393 that is intended to add real infinite query support to RTKQ - could you give that PR preview build a try and use the new  That said, I don't know why RTKQ might be dropping requests in this case. | 
Beta Was this translation helpful? Give feedback.
                  
                    3 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a page that displays a list of items. the problem is that is discarding requests seemingly at random especially when the user scrolls quickly. What am I doing wrong?
here is my react:
Here is my RTKQuery Api:
My console after scrolling around for a bit:


As you can see in the console.log, RTKQuery simply discarded the requests for pages 4, 5, and 6, and proceeded directly to 7. This is a problem as chunks of the list are missing. Everything works fine so long as the user scrolls slowly, but I can't count on that. I need something that will request all the data in question based on the user's scrolling.
Context: I'm using MUI DataGrid and I do not have a whole lot of flexibility on how I implement this. The only supplied option is a callback function that fires when the user scrolls down and hits unloaded rows.
Beta Was this translation helpful? Give feedback.
All reactions