@@ -148,10 +148,18 @@ function subscribeToInitialization(
148
148
clientReady : false ,
149
149
didTimeout : false ,
150
150
} ) ;
151
- res . dataReadyPromise ?. then ( ( ) => {
152
- hooksLogger . info ( 'Client became ready.' ) ;
151
+ res . dataReadyPromise ?. then ( ( readyResult ?: OnReadyResult ) => {
152
+ if ( ! readyResult ) {
153
+ return ;
154
+ }
155
+ const { success, message } = readyResult ;
156
+ if ( success ) {
157
+ hooksLogger . info ( 'Client became ready.' ) ;
158
+ } else {
159
+ hooksLogger . warn ( `Client not ready, reason="${ message } "` ) ;
160
+ }
153
161
onInitStateChange ( {
154
- clientReady : true ,
162
+ clientReady : success ,
155
163
didTimeout : false ,
156
164
} ) ;
157
165
} ) ;
@@ -162,10 +170,18 @@ function subscribeToInitialization(
162
170
clientReady : false ,
163
171
didTimeout : false ,
164
172
} ) ;
165
- res . dataReadyPromise ?. then ( ( ) => {
166
- hooksLogger . info ( 'User became ready later.' ) ;
173
+ res . dataReadyPromise ?. then ( ( readyResult ?: OnReadyResult ) => {
174
+ if ( ! readyResult ) {
175
+ return ;
176
+ }
177
+ const { success, message } = readyResult ;
178
+ if ( success ) {
179
+ hooksLogger . info ( 'User became ready later.' ) ;
180
+ } else {
181
+ hooksLogger . warn ( `Client not ready, reason="${ message } "` ) ;
182
+ }
167
183
onInitStateChange ( {
168
- clientReady : true ,
184
+ clientReady : success ,
169
185
didTimeout : false ,
170
186
} ) ;
171
187
} ) ;
@@ -176,10 +192,21 @@ function subscribeToInitialization(
176
192
clientReady : false ,
177
193
didTimeout : true ,
178
194
} ) ;
179
- res . dataReadyPromise ?. then ( ( ) => {
180
- hooksLogger . info ( 'Client became ready after timeout already elapsed' ) ;
195
+ res . dataReadyPromise ?. then ( ( readyResult ?: OnReadyResult ) => {
196
+ if ( ! readyResult ) {
197
+ return ;
198
+ }
199
+
200
+ const { success, message } = readyResult ;
201
+
202
+ if ( success ) {
203
+ hooksLogger . info ( 'Client became ready after timeout already elapsed' ) ;
204
+ } else {
205
+ hooksLogger . warn ( `Client not ready, reason="${ message } "` ) ;
206
+ }
207
+
181
208
onInitStateChange ( {
182
- clientReady : true ,
209
+ clientReady : success ,
183
210
didTimeout : true ,
184
211
} ) ;
185
212
} ) ;
@@ -188,13 +215,23 @@ function subscribeToInitialization(
188
215
hooksLogger . warn ( `Other reason client not ready, reason="${ res . message } "` ) ;
189
216
onInitStateChange ( {
190
217
clientReady : false ,
191
- didTimeout : true , // assume timeout
218
+ didTimeout : false ,
192
219
} ) ;
193
- res . dataReadyPromise ?. then ( ( ) => {
194
- hooksLogger . info ( 'Client became ready later' ) ;
220
+ res . dataReadyPromise ?. then ( ( readyResult ?: OnReadyResult ) => {
221
+ if ( ! readyResult ) {
222
+ return ;
223
+ }
224
+
225
+ const { success, message } = readyResult ;
226
+
227
+ if ( success ) {
228
+ hooksLogger . info ( 'Client became ready later' ) ;
229
+ } else {
230
+ hooksLogger . warn ( `Client not ready, reason="${ message } "` ) ;
231
+ }
195
232
onInitStateChange ( {
196
- clientReady : true ,
197
- didTimeout : true , // assume timeout
233
+ clientReady : success ,
234
+ didTimeout : false ,
198
235
} ) ;
199
236
} ) ;
200
237
}
0 commit comments