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(clerk-js): Avoid depending on count as it can be zero but invitations may still exist #3092

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Apr 2, 2024

Description

Background: In order to provide a better UX, we are manually updating the cache where userInvitations are stored. This allows us to update the invitation in place and avoid layout shifts, if we would simply revalidate this would not be possible.

We are also manually updating count in the local cache in order to display the correct number of invitations available, without revalidating as this would cause a layout shift.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@panteliselef panteliselef self-assigned this Apr 2, 2024
Copy link

changeset-bot bot commented Apr 2, 2024

🦋 Changeset detected

Latest commit: d0f8df5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@octoper
Copy link
Member

octoper commented Apr 2, 2024

!preview

Copy link
Contributor

@dimkl dimkl left a comment

Choose a reason for hiding this comment

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

❓ what is the actual use case where we want to have count 0 with invitations?
If there is no case (product wise) i think we need to open a bug ticket to the backend team to fix this.

@clerk-cookie
Copy link
Collaborator

clerk-cookie commented Apr 2, 2024

Hey @octoper, your preview is available.

Status Preview Updated (UTC)
🍪 Deployed Visit preview Apr 02, 2024 01:39 PM

@panteliselef
Copy link
Member Author

❓ what is the actual use case where we want to have count 0 with invitations? If there is no case (product wise) i think we need to open a bug ticket to the backend team to fix this.

@dimkl I updated the description. Generally count is very useful, for this particular case and because we manually update the cache instead of revalidating we need to use this differently.

Copy link
Member

@octoper octoper left a comment

Choose a reason for hiding this comment

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

💯

@panteliselef panteliselef force-pushed the elef/sdk-1574-joining-an-organization-does-not-update-the-organization branch from a8ac625 to 51af601 Compare April 2, 2024 14:19
@panteliselef panteliselef merged commit 6d3b422 into main Apr 3, 2024
10 checks passed
@panteliselef panteliselef deleted the elef/sdk-1574-joining-an-organization-does-not-update-the-organization branch April 3, 2024 08:48
@dimkl
Copy link
Contributor

dimkl commented Apr 4, 2024

@panteliselef Is the userInvitations or userSuggestions paginated responses? If so, is the count related to the total count data of the response?
If the count is related to the total count of the paginated response, i think we still need to depend on that instead of the length. Wdyt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants