fix(aio): do not show new document until embedded components are ready (#18428)

Previously, the document was shown as soon as the HTML was received, but before
the embedded components were ready (e.g. downloaded and instantiated). This
caused FOUC (Flash Of Uninstantiated Components).
This commit fixes it by preparing the new document in an off-DOM node and
swapping the nodes when the embedded components are ready.

PR Close #18428
This commit is contained in:
George Kalpakas
2017-11-23 15:03:56 +02:00
committed by Jason Aden
parent 7d81309e11
commit 131c8ab6be
3 changed files with 206 additions and 38 deletions

View File

@ -18,10 +18,13 @@ import { MockLogger } from 'testing/logger.service';
export class TestDocViewerComponent extends DocViewerComponent {
embeddedComponentRefs: ComponentRef<any>[];
currViewContainer: HTMLElement;
nextViewContainer: HTMLElement;
addTitleAndToc(docId: string): void { return null as any; }
destroyEmbeddedComponents(): void { return null as any; }
render(doc: DocumentContents): Observable<void> { return null as any; }
swapViews(): Observable<void> { return null as any; }
}