File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ export default class PodNotes extends Plugin implements IPodNotes {
66
66
} > ;
67
67
private transcriptionService : TranscriptionService ;
68
68
69
+ private maxLayoutReadyAttempts = 10 ;
70
+ private layoutReadyAttempts = 0 ;
71
+
69
72
async onload ( ) {
70
73
plugin . set ( this ) ;
71
74
@@ -281,6 +284,19 @@ export default class PodNotes extends Plugin implements IPodNotes {
281
284
}
282
285
283
286
onLayoutReady ( ) : void {
287
+ if ( ! this . app . workspace || ! this . app . workspace . layoutReady ) {
288
+ // Workspace is not ready, schedule a retry
289
+ this . layoutReadyAttempts ++ ;
290
+ if ( this . layoutReadyAttempts < this . maxLayoutReadyAttempts ) {
291
+ setTimeout ( ( ) => this . onLayoutReady ( ) , 100 ) ;
292
+ } else {
293
+ console . error (
294
+ "Failed to initialize PodNotes layout after maximum attempts" ,
295
+ ) ;
296
+ }
297
+ return ;
298
+ }
299
+
284
300
if ( this . app . workspace . getLeavesOfType ( VIEW_TYPE ) . length ) {
285
301
return ;
286
302
}
You can’t perform that action at this time.
0 commit comments