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

fix: manually update apollo cache on activity completion #138

Merged
merged 10 commits into from
Jul 24, 2023

Conversation

mohsinht
Copy link
Contributor

@mohsinht mohsinht commented Jul 21, 2023

  • Sometimes the cache is not properly updated in case of form submission or checklist submission. The same completed activity is shown to the user again. We've been observing this in DataDog tests and Checkly. To solve this issue, I've added a hook that forces the Apollo Cache to update the session activities manually. (see loom)
    • Please note that the cache was previously updated by the subscriptions only. With this change in the PR, we now update the cache when a form/checklist is submitted + when an activity is updated from subscription.
  • We also had a tech debt that we are using indices to navigate through the activities instead of their IDs. This PR also includes a small refactor that addresses this change.

@mohsinht mohsinht requested a review from FlavioF July 21, 2023 15:09
@vercel
Copy link

vercel bot commented Jul 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hosted-pages ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2023 3:36pm

@mohsinht mohsinht changed the title refactor: use activity id instead of activity index to determine next activity fix: manually update apollo cache on activity completion Jul 24, 2023
Copy link
Contributor

@rahulkeerthi rahulkeerthi left a comment

Choose a reason for hiding this comment

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

I see that you've updated the hooks associated with mutations for messages, forms and checklists. Does the cache update hook need to be used for other user activity types/hooks? e.g. cal.com booking activity?

src/hooks/activityNavigation/ActivityProvider.tsx Outdated Show resolved Hide resolved
src/hooks/activityNavigation/ActivityProvider.tsx Outdated Show resolved Hide resolved
@rahulkeerthi rahulkeerthi added bug Something isn't working echoes/intent: unblock Changes needed to solve a bug or unblock a customer echoes/impediment: technical-debt Change made difficult by technical debt (e.g., high coupling, lack of tests) refactor Refactor, does not add or change functionality labels Jul 24, 2023
@mohsinht
Copy link
Contributor Author

Does the cache update hook need to be used for other user activity types/hooks? e.g. cal.com booking activity?

Yes, I was adding cache update function where we call handleNavigateToNextActivity(). It was indeed missing in the extension activities. Thanks for pointing that out

…github.com:awell-health/hosted-pages into refactor/use-activity-id-instead-of-activity-index
@mohsinht mohsinht merged commit bedc136 into main Jul 24, 2023
3 checks passed
@mohsinht mohsinht deleted the refactor/use-activity-id-instead-of-activity-index branch July 24, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working echoes/impediment: technical-debt Change made difficult by technical debt (e.g., high coupling, lack of tests) echoes/intent: unblock Changes needed to solve a bug or unblock a customer refactor Refactor, does not add or change functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants