Skip to content

Conversation

brionmario
Copy link
Member

@brionmario brionmario commented Aug 4, 2025

Purpose

This pull request introduces improvements to the React client session management and loading state handling, as well as some code style and consistency updates in workflow and script files. The most significant changes focus on making session updates more robust and preventing race conditions during authentication, along with minor refactoring for clarity and maintainability.

React Client & Provider Improvements

  • Added an isUpdatingSession flag and logic in AsgardeoProvider.tsx to prevent race conditions and ensure accurate loading and sign-in state during critical session updates such as sign-in, silent sign-in, and organization switching. This helps avoid UI inconsistencies, especially in protected routes. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Refactored the session update flow to update user data and sign-in status in a specific order, preventing UI from showing as not signed in when loading is false.
  • Wrapped several asynchronous methods in AsgardeoReactClient.ts (getDecodedIdToken, getUserProfile, getCurrentOrganization, getAccessToken) with withLoading to ensure consistent loading state management. [1] [2] [3] [4]
  • Minor fix to the isSignedIn method to make it explicitly async and use await.
  • Added missing import for IdToken in AsgardeoProvider.tsx.

Workflow and Script Consistency

  • Updated YAML quoting style for title and commit fields in .github/workflows/release.yml for consistency, and reformatted the if condition for readability. [1] [2]
  • Refactored scripts/aggregate-changelogs.js for better readability and consistency: collapsed SKIP_PACKAGES to a single line, converted some arrow functions to a more concise form, and adjusted function closing brackets. [1] [2] [3]

Related Issues

Related PRs

  • N/A

Checklist

  • e2e cypress tests locally verified.
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

@brionmario brionmario changed the title fix: fix the race condition when ProtectedRoute is used fix: avoid the race condition when ProtectedRoute is used Aug 8, 2025
…ency

- Consolidated array declaration for SKIP_PACKAGES into a single line.
- Removed unnecessary line breaks and adjusted spacing for function definitions and conditions.
- Enhanced code clarity by simplifying the structure of the findChangelogs function.
@brionmario brionmario merged commit 04efdec into asgardeo:main Aug 19, 2025
2 of 4 checks passed
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