zino-hofmann / graphql-flutter

A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
https://zino-hofmann.github.io/graphql-flutter
MIT License
3.23k stars 613 forks source link

How does ResultsAccumulator handle uniqueness? #1337

Open cinjon opened 1 year ago

cinjon commented 1 year ago

I'm finding that ResultsAccumulator is accumulating everything. How do I get it to not do that? Can I change the unique definition? See below for an example where all of these null values are being saved.

results [{messageAlerts: null}, {messageAlerts: null}, {messageAlerts: null}, {messageAlerts: null}, {messageAlerts: null}, {messageAlerts: null}, {messageAlerts: null}, {messageAlerts: null}]

vincenzopalazzo commented 1 year ago

Mh this is a good question, I should find some time at the end of the month to look inside it

cinjon commented 1 year ago

I looked into the code after posting this, and it is just appending to a list after checking for contains. It would require having a smarter contains to fix this. For my needs, I inherited and changed the appendUnique function to work with my specific data.