AdeleD / react-paginate

A ReactJS component that creates a pagination
MIT License
2.76k stars 628 forks source link

Hangs forever when pageCount is `Infinity` #515

Open gsouf opened 6 months ago

gsouf commented 6 months ago

The following code will cause the browser to hang forever:

  <ReactPaginate
    pageCount={Infinity}
   ....
  />

Most likely it falls into an endless loop.

While a user shouldn't pass infinity, it can be done by mistake and the fact that it breaks and freezes the whole UI without a notice makes it hard to figure out. For example it will happen if the user divides something 0, that javascript allows.

NgoKnows commented 5 months ago

I noticed with really large page counts, this component gets very slow. Were you able to find any workaround?

gsouf commented 5 months ago

@NgoKnows the issue I mentioned about infinity is not about being slow, it's about falling into something like an endless loop and totally freezing the browser.

I haven't had to deal with large page count, so I can't really tell about it sorry

semanticist21 commented 4 weeks ago

As the maintainer does not update this pkg for a long time, I think you should manage it by yourself.