Skip to content

Commit

Permalink
Defer notification area rendering until app ready.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta authored and kittaakos committed Aug 9, 2022
1 parent 7a3e678 commit 8a1cabd
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
import * as React from '@theia/core/shared/react';
import * as ReactDOM from '@theia/core/shared/react-dom';
import { injectable } from '@theia/core/shared/inversify';
import {
inject,
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import { NotificationCenterComponent } from './notification-center-component';
import { NotificationToastsComponent } from './notification-toasts-component';
import { NotificationsRenderer as TheiaNotificationsRenderer } from '@theia/messages/lib/browser/notifications-renderer';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';

@injectable()
export class NotificationsRenderer extends TheiaNotificationsRenderer {
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

@postConstruct()
protected override init(): void {
// Unlike Theia, IDE2 renders the notification area only when the app is ready.
this.appStateService.reachedState('ready').then(() => {
this.createOverlayContainer();
this.render();
});
}

protected override render(): void {
ReactDOM.render(
<div>
Expand Down

0 comments on commit 8a1cabd

Please sign in to comment.