@@ -60,34 +60,7 @@ const AuthDebugger = ({
60
60
} : AuthDebuggerProps ) => {
61
61
// Load client info asynchronously when we're at the token_request step
62
62
63
- const validateOAuthMetadata = async (
64
- provider : DebugInspectorOAuthClientProvider ,
65
- ) : Promise < OAuthMetadata > => {
66
- const metadata = provider . getServerMetadata ( ) ;
67
- if ( metadata ) {
68
- return metadata ;
69
- }
70
-
71
- const fetchedMetadata = await discoverOAuthMetadata ( sseUrl ) ;
72
- if ( ! fetchedMetadata ) {
73
- throw new Error ( "Failed to discover OAuth metadata" ) ;
74
- }
75
- const parsedMetadata =
76
- await OAuthMetadataSchema . parseAsync ( fetchedMetadata ) ;
77
-
78
- return parsedMetadata ;
79
- } ;
80
-
81
- const validateClientInformation = async (
82
- provider : DebugInspectorOAuthClientProvider ,
83
- ) : Promise < OAuthClientInformation > => {
84
- const clientInformation = await provider . clientInformation ( ) ;
85
-
86
- if ( ! clientInformation ) {
87
- throw new Error ( "Can't advance without successful client registration" ) ;
88
- }
89
- return clientInformation ;
90
- } ;
63
+ // These functions will be moved inside proceedToNextStep to avoid ESLint warning
91
64
92
65
const startOAuthFlow = useCallback ( ( ) => {
93
66
if ( ! sseUrl ) {
@@ -113,6 +86,36 @@ const AuthDebugger = ({
113
86
if ( ! sseUrl ) return ;
114
87
const provider = new DebugInspectorOAuthClientProvider ( sseUrl ) ;
115
88
89
+ // Helper functions moved inside useCallback to avoid ESLint warning
90
+ const validateOAuthMetadata = async (
91
+ provider : DebugInspectorOAuthClientProvider ,
92
+ ) : Promise < OAuthMetadata > => {
93
+ const metadata = provider . getServerMetadata ( ) ;
94
+ if ( metadata ) {
95
+ return metadata ;
96
+ }
97
+
98
+ const fetchedMetadata = await discoverOAuthMetadata ( sseUrl ) ;
99
+ if ( ! fetchedMetadata ) {
100
+ throw new Error ( "Failed to discover OAuth metadata" ) ;
101
+ }
102
+ const parsedMetadata =
103
+ await OAuthMetadataSchema . parseAsync ( fetchedMetadata ) ;
104
+
105
+ return parsedMetadata ;
106
+ } ;
107
+
108
+ const validateClientInformation = async (
109
+ provider : DebugInspectorOAuthClientProvider ,
110
+ ) : Promise < OAuthClientInformation > => {
111
+ const clientInformation = await provider . clientInformation ( ) ;
112
+
113
+ if ( ! clientInformation ) {
114
+ throw new Error ( "Can't advance without successful client registration" ) ;
115
+ }
116
+ return clientInformation ;
117
+ } ;
118
+
116
119
try {
117
120
updateAuthState ( {
118
121
isInitiatingAuth : true ,
@@ -213,7 +216,7 @@ const AuthDebugger = ({
213
216
} finally {
214
217
updateAuthState ( { isInitiatingAuth : false } ) ;
215
218
}
216
- } , [ sseUrl , authState , updateAuthState , validateOAuthMetadata ] ) ;
219
+ } , [ sseUrl , authState , updateAuthState ] ) ;
217
220
218
221
const handleStartOAuth = useCallback ( async ( ) => {
219
222
if ( ! sseUrl ) {
0 commit comments