Skip to content

Conversation

@ryanbonial
Copy link
Member

@ryanbonial ryanbonial commented Oct 30, 2025

Description

Improved the token refresh mechanism test in the ComlinkTokenRefresh by:

  • Removing dependency on useSanityInstance hook and using ResourceProvider context instead
  • Adding functionality to remove Unauthorized error containers from the DOM after successful token refresh
  • Implementing deduplication of multiple 401 errors while a refresh is in progress
  • Adding a timeout mechanism to retry token refresh if a previous request doesn't resolve
  • Enhancing tests to verify proper behavior with the ResourceProvider

What to review

  • The removal of useSanityInstance dependency and related mocks
  • The new error container cleanup functionality
  • The token refresh deduplication logic
  • The timeout-based retry mechanism
  • The updated test assertions that verify the component works correctly with ResourceProvider

Testing

Added comprehensive tests for the new functionality:

  • Test for error container removal after successful token refresh
  • Test for deduplication of multiple 401 errors during an in-progress refresh
  • Test for retry behavior after timeout when a request doesn't resolve
  • Updated existing tests to work with ResourceProvider instead of useSanityInstance

Fun gif

getting better

@vercel
Copy link

vercel bot commented Oct 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sdk-docs Ready Ready Preview Comment Nov 13, 2025 8:23pm
sdk-kitchensink-react Ready Ready Preview Comment Nov 13, 2025 8:23pm

@ryanbonial ryanbonial marked this pull request as ready for review October 30, 2025 19:10
@ryanbonial ryanbonial requested a review from a team as a code owner October 30, 2025 19:10
@ryanbonial ryanbonial requested a review from cngonzalez October 30, 2025 19:10
@ryanbonial ryanbonial enabled auto-merge (squash) November 13, 2025 20:22
@ryanbonial ryanbonial merged commit 0a5e1aa into main Nov 13, 2025
18 checks passed
@ryanbonial ryanbonial deleted the rb/comlin-token-refresh-less-mock branch November 13, 2025 20:25
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.

2 participants