Don't set config from OAuth callbacks until after it has been loaded

This commit is contained in:
Alex Gleason committed 2025-10-18 22:08:58 -05:00
1 parent fcc5d26faa
commit bfe8d76db4
11 files changed
+49 -194

No files matched your search

+7 -2
View File
@@ -21,7 +21,7 @@ interface VercelUserInfo {
* Uses the generic useOAuth hook with Vercel-specific configuration.
*/
export function useVercelOAuth() {
const { setProviders, settings } = useDeploySettings();
const { setProviders, settings, isInitialized } = useDeploySettings();
// Vercel OAuth configuration
const config: OAuthConfig = {
@@ -62,6 +62,11 @@ export function useVercelOAuth() {
code: string,
state: string
): Promise<boolean> => {
// Wait for settings to be initialized before processing
if (!isInitialized) {
return false;
}
const result: OAuthResult | null = await oauth.handleCallback(code, state);
if (!result) {
@@ -82,7 +87,7 @@ export function useVercelOAuth() {
setProviders([...settings.providers, newProvider]);
return true;
}, [oauth, setProviders, settings.providers]);
}, [oauth, setProviders, settings.providers, isInitialized]);
return {
...oauth,