meteor-pages icon indicating copy to clipboard operation
meteor-pages copied to clipboard

More than 2 Paginated pages/collections infinite loading

Open SpyridonZ opened this issue 8 years ago • 10 comments

I started my project with a single Pagination object. It was for a Product Collection, worked fine.

Needed a 2nd page/template/collection with Pagination. Used the same process the 2nd time, works perfectly.

Did the same thing again for a 3rd page/template/collection. As soon as a 3rd pagination object is created, 1 of the 3 will then have an infinite loading.

I tested multiple times to made sure I made no mistakes, and used the same exact process for setting it up. It seems that 3 Pagination objects causes infinite loading?

SpyridonZ avatar May 05 '16 18:05 SpyridonZ

@SpyridonZ any luck? Are you sure that reason is in paginated collections count? I faced the same problem after updating my application from meteor 1.2 to 1.3.

radik avatar May 24 '16 19:05 radik

@radik None yet. But I did receive a post from someone suggesting a fix. I have not tried it yet. Here is what he suggested:

"Same thing happens to me for more than 2 pagination objects until i call paginatedCollection.set() (for filtering). So for the meantime i just placed a paginatedCollection.set() on Template.templatename.rendered to get it to work."

If you try that and it works, please post here that it worked!

SpyridonZ avatar May 24 '16 20:05 SpyridonZ

@SpyridonZ that was me, i forgot why i deleted the comment, but to be exact it's paginatedCollection.set(function(){return 1});. I get a message saying "changing deprecated not allowed" but i just ignore it.

oloapozram avatar May 25 '16 03:05 oloapozram

@SpyridonZ Following helped for me

// inside Template.projects_list.onRendered
ProjectsPage.requestPage(1);

Seems like something happened with initial page loading. I tried ProjectsPage.set for filter, but it didn't work when filter is empty.

radik avatar May 31 '16 07:05 radik

Thanks @radik 👍

oskareke avatar Jun 27 '16 11:06 oskareke

Worked for me as well, thanks for sharing!

ghost avatar Sep 04 '16 12:09 ghost

Thank you, @radik!!! This saved me.

domenester avatar Nov 09 '16 03:11 domenester

Same problem here. Didn't do thorough testing to be sure of the problem but I had 3 x pagination collections and the same issue with the infinite spinner on one of them.

Tried both the .requestPage(1) and the .set(function(){return 1}) fixes from within onRendered (and indeed an onClick event but with no joy.

the fix for me was to give a different name to each declaration. I was using "Pages" for all three collection.

ie: this.Pages = new Meteor.Pagination(Collection, { route: ... router:... etc... });

Worked fine for 2 collections but not when the third came along....

markymo avatar Jan 09 '17 13:01 markymo

Thanks a million, requestPage(1); saved me another day of frustration. I also ran into this issue when using more than two pagination objects.

sushitommy avatar Jan 30 '17 09:01 sushitommy

This used to workbefore alethes-pages updated to Meteor 1.3. Before that, you could have any number of pagination objects. Now if there are more than 2 from the same collection, the later ones don't provide any results.

Many thanks to @radik for the suggestion to use requestPage when the template is rendered:

// inside Template.projects_list.onRendered
ProjectsPage.requestPage(1);

where ProjectsPage is the name of your pagination object

This fixed it for me.

Shelagh-Lewins avatar Dec 05 '17 17:12 Shelagh-Lewins