-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
4a80fbe
to
8d0119b
Compare
setTimeout(() => { | ||
queryClient | ||
.invalidateQueries({queryKey: [INVITE_KEY, PROJECTS_KEY]}) | ||
.then(() => { | ||
if (projectId) { | ||
switchActiveProject(projectId); | ||
} | ||
}); | ||
}, 5000); |
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.
This setTimeout is a workaround.
Race condition is happening where:
- invitee accepts invite
- invitation resolves
- when invitation resolves, the cache of
allprojects
is refetched - 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
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.
I could see adding a comment explaining this, but I hope to fix this soon in any case.
setTimeout(() => { | ||
queryClient | ||
.invalidateQueries({queryKey: [INVITE_KEY, PROJECTS_KEY]}) | ||
.then(() => { | ||
if (projectId) { | ||
switchActiveProject(projectId); | ||
} | ||
}); | ||
}, 5000); |
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.
I could see adding a comment explaining this, but I hope to fix this soon in any case.
return; | ||
} | ||
sendInviteMutation.mutate( | ||
// @ts-ignore |
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.
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 |
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.
Nitpick:
// 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 |
Screen to indicate that cancelling an invite was unsuccessful.
closes #234