adopted-ember-addons / ember-infinity

:zap: Simple, flexible Infinite Scroll for Ember CLI Apps.
MIT License
377 stars 131 forks source link

Ember Infinity not working with latest Ember Data 3.17.0 & 3.16.0 #420

Closed kushthedude closed 4 years ago

kushthedude commented 4 years ago

We recently upgraded our ember-data from 3.14.1 to 3.16.0, but this upgrade broke the infinity loaders at all the places by fetching the same data again & again.

It would be great if the support for 3.16.0 can be extended soon. References : https://github.com/fossasia/open-event-frontend/pull/3950 https://github.com/fossasia/open-event-frontend/issues/3986

cc: @snewcomer

snewcomer commented 4 years ago

Do you know what specifically broke?

kushthedude commented 4 years ago

I didn't get time to check as we had to make the production release, but I will let you know once I get into it again.

iamareebjamal commented 4 years ago

Instead of fetching another page on scrolling to bottom, all the loader items are appended again, and loaded individually from backend.

And the problem starts from Ember Data 3.15

So, for example, /speakers?page[size]=12&page=1 loads first page. Starting from Ember Data 3.15, instead of loading /speakers?page[size]=12&page=2, it makes 12 requests for each speaker, like /speakers/1, /speakers/2, /speakers/3 ... /speakers/12 and then append the previously loaded speakers again this way

iamareebjamal commented 4 years ago

Example:

Ember Data 3.16.0 (Broken) https://dist.iamareebjamal.now.sh/e/a74665c3/speakers

Ember Data 3.14.1 (Correct) https://eventyay.com/e/a74665c3/speakers

snewcomer commented 4 years ago

https://github.com/emberjs/ember.js/releases/tag/v3.17.0

It might be good to check if 3.17 fixes it!

iamareebjamal commented 4 years ago

It didn't

boydkr commented 4 years ago

I recently tried upgrading to Ember 3.16, and I get error messages with the InfinityModel:

index.js:172 Uncaught Error: Assertion Failed: You attempted to update `perPageParam` on `<InfinityModel:ember1781>`, but it had already been used previously in the same computation.  Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.

With a stack trace for the offending modification coming from infinity.js#model:

Ember.setProperties(infinityModel, { ...initParams
      });
DuBistKomisch commented 4 years ago

FWIW our experience with 3.16 breaking everything has finally been resolved:

Can't speak for 3.17 since the glimmer VM update seems to have broken ember-wormhole even more than the 2.10 one did. 🤦‍♂️

snewcomer commented 4 years ago

Thank you for letting us know! Closing for now since the backport and your PR seems to have resolved all issues! Thanks again for the PR!!