AmpersandJS / ampersand-paginated-subcollection

Filter an ampersand-collection by limit and offset
MIT License
4 stars 1 forks source link

Should run collection methods on collection #13

Closed bryanspears closed 3 years ago

bryanspears commented 7 years ago

If not, and you have a subcollection as the collection, then you get infinite recursion and a bad time.

This fixes a serious issue that appears when you filter a paginated subcollection or vise-versa.

bryanspears commented 7 years ago

Addresses https://github.com/AmpersandJS/ampersand-paginated-subcollection/issues/12

bryanspears commented 7 years ago

Looks like the test fails to run. Locally the tests ran fine.

wraithgar commented 7 years ago

Won't this serialize the parent collection in its entirety instead of our paginated subset?

bryanspears commented 7 years ago

That's... true. Snap.

I'm currently out of ideas how to allow using other subcollections as the collection inside a subcollection. Other than creating a new module: "ampersand-all-the-things-subcollection" that allows for filtering and pagination. This worked pre-2.0 (I think. Did blanket upgrade on my modules. I'll have to check). I guess I'll just downgrade for now.

wraithgar commented 7 years ago

I think you're headed in the right direction w/ this fix, we just need to maybe handle serialize and toJSON manually instead of delegating. The only reason it was done this way was because we did it that way in the original, to prevent duplicated code. But when that's becoming a problem it's worth just dumping.