Generalize the mechanism on how to setup appContext
- Don't rely on a global for the initialization logic
- Generalize the logic to support any Context type
Google-Bug-Id: b/206459178
Change-Id: I3ce49e38a17bdca144dfb794625b4153a275315e
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index 4f6702d..d1ddd31 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -31,7 +31,7 @@
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-comment_html';
import {getRootElement} from '../../../scripts/rootElement';
-import {appContext} from '../../../services/app-context';
+import {getAppContext} from '../../../services/app-context';
import {customElement, observe, property} from '@polymer/decorators';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {GrTextarea} from '../gr-textarea/gr-textarea';
@@ -274,13 +274,13 @@
/** Called in disconnectedCallback. */
private cleanups: (() => void)[] = [];
- private readonly restApiService = appContext.restApiService;
+ private readonly restApiService = getAppContext().restApiService;
- private readonly storage = appContext.storageService;
+ private readonly storage = getAppContext().storageService;
- private readonly reporting = appContext.reportingService;
+ private readonly reporting = getAppContext().reportingService;
- private readonly commentsService = appContext.commentsService;
+ private readonly commentsService = getAppContext().commentsService;
private fireUpdateTask?: DelayedTask;