Skip to content
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

Merged
merged 12 commits into from
Mar 24, 2023
Merged

Fixed conversations issue #2322

merged 12 commits into from
Mar 24, 2023

Conversation

mdshamoon
Copy link
Member

@mdshamoon mdshamoon commented Feb 13, 2023

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.

@codecov
Copy link

codecov bot commented Feb 13, 2023

Codecov Report

Patch coverage: 54.54% and project coverage change: -0.03 ⚠️

Comparison is base (0bf520f) 71.12% compared to head (d3dcec7) 71.10%.

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              
Impacted Files Coverage Δ
...onversations/ConversationList/ConversationList.tsx 65.96% <54.54%> (-1.05%) ⬇️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Feb 13, 2023

@github-actions github-actions bot temporarily deployed to pull request February 13, 2023 16:30 Inactive
@cypress
Copy link

cypress bot commented Feb 13, 2023

Passing run #3256 ↗︎

0 176 0 0 Flakiness 0

Details:

Merge d3dcec7 into 0bf520f...
Project: Glific Commit: 5bd2b91af7 ℹ️
Status: Passed Duration: 38:17 💡
Started: Mar 24, 2023 7:36 AM Ended: Mar 24, 2023 8:15 AM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@mdshamoon mdshamoon requested a review from kurund February 14, 2023 06:51
@github-actions github-actions bot temporarily deployed to pull request February 14, 2023 22:51 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 15, 2023 23:31 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 20, 2023 06:16 Inactive
Copy link
Contributor

@kurund kurund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdshamoon

The issue still persists. Here are the steps to replicate.

  1. Go to chat and click on the second contact.
  2. Click contact load more
  3. Click on any of newly added contact's in the list.
  4. Contact clicked and additional 1 contact after above contact is duplicated.

@github-actions github-actions bot temporarily deployed to pull request February 21, 2023 00:07 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 21, 2023 07:54 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 9, 2023 06:34 Inactive
@mdshamoon
Copy link
Member Author

@kurund there are two issues that are causing this:

  1. onCompleted is called on every click after we have clicked on Loadmore that adds duplicate contacts.
  2. The search query is also returning some duplicate contacts with a different offset (This seems to happen only on local and not on production)

I have fixed the first case in this branch and created issue for the second in the backend glific/glific#2696.
Let me know if we can merge this and tackle that separately

@mdshamoon mdshamoon requested a review from kurund March 17, 2023 05:25
@github-actions github-actions bot temporarily deployed to pull request March 17, 2023 11:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 21, 2023 04:16 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 24, 2023 07:25 Inactive
Copy link
Contributor

@kurund kurund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@kurund kurund merged commit 63757aa into master Mar 24, 2023
@kurund kurund deleted the fix/conversations branch March 24, 2023 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Load more' on the platform is jittery and position of chats is changing in the list
2 participants