refactor(hub-client): AuthProvider interface for GIS coupling#219
Merged
Conversation
Introduce an `AuthProvider` interface (sign-in button, silent renewal, signout). `LoginScreen`, `useAuth`, `authService`, and `main.tsx` depend on it via React context; only `auth/GoogleAuthProvider.tsx` and `main.tsx` import `@react-oauth/google` directly. Auth-disabled mode uses a `noopAuthProvider` so consumers never branch on null. No behaviour change. Plan: `claude-notes/plans/2026-05-20-auth-provider-interface.md`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
@react-oauth/googleis imported across five production files; with a second backend that becomes ten. A thin interface caps the blast radius — adding another provider later means writing one file and swapping one factory call inmain.tsx.noopAuthProviderinstead ofAuthProvider | nullbecause every alternative forced consumers to branch (provider?.useSilentRenewal(...)is also a conditional hook call, whichreact-hooks/rules-of-hooksflags).What
AuthProviderinterface (sign-in button, silent renewal, signout) consumed via React context.LoginScreen,useAuth,authService,main.tsxno longer import@react-oauth/googledirectly — onlyauth/GoogleAuthProvider.tsxandmain.tsx's SDK-loader wrap do.VITE_GOOGLE_CLIENT_IDunset) modelled bynoopAuthProvider; consumers don't branch on null.claude-notes/plans/2026-05-20-auth-provider-interface.md.