-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed conversations issue #2322
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2322 +/- ##
==========================================
- Coverage 71.12% 71.10% -0.03%
==========================================
Files 229 229
Lines 8052 8049 -3
Branches 1731 1730 -1
==========================================
- Hits 5727 5723 -4
- Misses 1765 1766 +1
Partials 560 560
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Passing run #3256 ↗︎Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue still persists. Here are the steps to replicate.
- Go to chat and click on the second contact.
- Click contact load more
- Click on any of newly added contact's in the list.
- Contact clicked and additional 1 contact after above contact is duplicated.
…to fix/conversations
…frontend into fix/conversations
…to fix/conversations
@kurund there are two issues that are causing this:
I have fixed the first case in this branch and created issue for the second in the backend glific/glific#2696. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Summary
The root cause for the issue:
onCompleted is getting called on every render which appends the same contacts at the end of the list after we click on loadmore. If contacts with same id's are appended to the list the apollo cache invalidates and restores the original data hence causing this issue.
Things I tried:
Using useLazyQuery's promise approach but it was not working and there are a few issues with that in apollo client. I have used the alternative that was suggested in the comments on the apollo client issues i.e. to use the client object directly.
With this it seems to be working fine.