Closed Pet3ris closed 2 years ago
The subscription result is memoized specifically to avoid this. If you're getting different objects on each render, I suspect this is an issue with Apollo. Can you confirm the behavior with vanilla JS? A workaround in the meantime is perhaps to watch specific properties of the subscription result rather than the whole object.
Thanks @jeddeloh, one thing I'm trying now is to add an _id
field to each object that is being returned since there was a warning from apollo that recommends it.
Will update here once I see if that fixes it.
Unfortunately, id alone didn't fix the issue. I ended up following your suggestion and added a manual if
statement to check if the id has changed from request to request.
@Pet3ris, shall we close this or do you still plan to confirm the behavior in vanilla JS Apollo client?
Feel free to close - I’ve went with the work around! Thanks for checking.
Hi There,
I'm using the hooks API for subscriptions in the following way:
Then when I'm checking for changes, multiple updates occur with the same value:
Is this intended behavior?