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

Es/unable to cancel invite #263

Merged
merged 12 commits into from
Apr 22, 2024
Merged

Es/unable to cancel invite #263

merged 12 commits into from
Apr 22, 2024

Conversation

ErikSin
Copy link
Contributor

@ErikSin ErikSin commented Apr 19, 2024

Screen to indicate that cancelling an invite was unsuccessful.

image

closes #234

@ErikSin ErikSin force-pushed the es/unable-to-cancel-invite branch from 4a80fbe to 8d0119b Compare April 22, 2024 21:10
@ErikSin ErikSin requested a review from achou11 April 22, 2024 21:11
Comment on lines +32 to +40
setTimeout(() => {
queryClient
.invalidateQueries({queryKey: [INVITE_KEY, PROJECTS_KEY]})
.then(() => {
if (projectId) {
switchActiveProject(projectId);
}
});
}, 5000);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This setTimeout is a workaround.

Race condition is happening where:

  1. invitee accepts invite
  2. invitation resolves
  3. when invitation resolves, the cache of allprojects is refetched
  4. user is switched to the new project.

Between steps 2 and 3 there is a race condition, where the project has not been created yet, so the project in unavailable. This was discussed with @EvanHahn

Copy link
Contributor

Choose a reason for hiding this comment

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

I could see adding a comment explaining this, but I hope to fix this soon in any case.

@ErikSin ErikSin marked this pull request as ready for review April 22, 2024 21:19
Comment on lines +32 to +40
setTimeout(() => {
queryClient
.invalidateQueries({queryKey: [INVITE_KEY, PROJECTS_KEY]})
.then(() => {
if (projectId) {
switchActiveProject(projectId);
}
});
}, 5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

I could see adding a comment explaining this, but I hope to fix this soon in any case.

return;
}
sendInviteMutation.mutate(
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this error happening because role is invalid? If so, this was fixed in 1a34eb3. You should be able to merge main to pick this up.

{deviceId, role: {roleId: role}},
{
onSuccess: val => {
// If user has attempted to cancel and invite, but an invite has been accepted, let user know their cancellation was unsuccessfuly
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick:

Suggested change
// If user has attempted to cancel and invite, but an invite has been accepted, let user know their cancellation was unsuccessfuly
// If user has attempted to cancel and invite, but an invite has been accepted, let user know their cancellation was unsuccessful

@ErikSin ErikSin merged commit 38f73c7 into main Apr 22, 2024
3 checks passed
@ErikSin ErikSin deleted the es/unable-to-cancel-invite branch April 22, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project Invitation / Unable to cancel
2 participants