Skip to content

Conversation

@ErikSin
Copy link
Contributor

@ErikSin ErikSin commented Dec 1, 2025

toward #1597

Invaidates the members role query after they get invited. If they were previously blocked, we want to invalidate the cache so that it shows that the new role after they have been invited

@ErikSin ErikSin requested a review from achou11 December 1, 2025 18:45
Comment on lines +80 to +82
queryClient.invalidateQueries({
queryKey: getProjectRoleQueryKey({ projectId }),
})
Copy link
Member

@achou11 achou11 Dec 1, 2025

Choose a reason for hiding this comment

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

This shouldn't be needed as it should already be happening due to the invalidation call right above this due to invalidation cascade. Can you confirm if this actually fixes anything? I'd be surprised if it changes anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If your correct, then it could be a race condition where the query has been invalidated, but its serving the stale value while its refetching, and that stale value is triggering the listener to navigate to the "removed bottom sheet". I can try suspending the navigation action while it is being refetched to see if that will solve this issue

Copy link
Member

@achou11 achou11 Dec 1, 2025

Choose a reason for hiding this comment

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

As a sanity check for myself, here's what should be happening based on the relevant react query docs:

  1. The query key path you're targeting here is: root/projects/<projectId>/role
  2. The invalidation happening above what you added is invalidating: root/projects

Since the path in (1) is a subpath of the path in (2), the invalidation should be happening.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this refetch check:
image

The problem is still happening. So I don't think its a race condition

The next step I will try is to package this pr as a tarball and try it out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, i packaged this fix, and used it in mobile and it did NOT solve the issue

@ErikSin
Copy link
Contributor Author

ErikSin commented Dec 1, 2025

For posterity, I tried three fixes:

  1. Not dispatching the removal bottom sheet until the the refetching was complete
  2. packaging this PR and making sure the query was invalidated explicitly
  3. Doing both these fixes at the same time

And the problem still existed in all 3 scenarios

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.

3 participants