kamikat / moshi-jsonapi

JSON API v1.0 Specification in Moshi.
MIT License
156 stars 34 forks source link

Merging two ArrayDocuments with "addAll" seems to not add "includes" #64

Closed davidherer closed 7 years ago

davidherer commented 7 years ago

I have an infinite scroll view which loads paginated data. When I load the second page and want to add it to the first ArrayDocument (with firstArrayDocument.addAll(mySecondArrayDocument)), the side-loaded data seem to not be correctly added since the relationships for the second loading give me null values. Any idea or tricks to resolve my problem? Thanks a lot

kamikat commented 7 years ago

Umm... Maybe includeAll(Collection<Resource>) and excludeAll(Collection<Resource>)?

kamikat commented 7 years ago

Introduce new API in 3.3.0:

ArrayDocument<...> document1, document2;
document1.addAll(document2);
document1.getIncluded().addAll(document2.getIncluded());