fix(aio): do not redirect pages on "next" deployment (#21027)
We redirect non-docs pages in the "archive" deployment back to the stable deployment. We should not redirect pages in the "next" deployment. Closes #19505 PR Close #21027
This commit is contained in:
parent
81823e89cd
commit
6588ca8a6c
|
@ -723,14 +723,14 @@ describe('AppComponent', () => {
|
||||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to `docs` if deployment mode is `next` and not at a docs page', () => {
|
it('should not redirect if deployment mode is `next`', () => {
|
||||||
createTestingModule('', 'next');
|
createTestingModule('', 'next');
|
||||||
initializeTest();
|
initializeTest();
|
||||||
expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs');
|
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||||
|
|
||||||
createTestingModule('resources', 'next');
|
createTestingModule('resources', 'next');
|
||||||
initializeTest();
|
initializeTest();
|
||||||
expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs');
|
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||||
|
|
||||||
createTestingModule('guide/aot-compiler', 'next');
|
createTestingModule('guide/aot-compiler', 'next');
|
||||||
initializeTest();
|
initializeTest();
|
||||||
|
@ -757,7 +757,7 @@ describe('AppComponent', () => {
|
||||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not redirect to `docs` if deployment mode is `stable` and not at a docs page', () => {
|
it('should not redirect to `docs` if deployment mode is `stable`', () => {
|
||||||
createTestingModule('', 'stable');
|
createTestingModule('', 'stable');
|
||||||
initializeTest();
|
initializeTest();
|
||||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||||
|
|
|
@ -121,9 +121,9 @@ export class AppComponent implements OnInit {
|
||||||
this.documentService.currentDocument.first().subscribe(doc => this.updateHostClassesForDoc(doc));
|
this.documentService.currentDocument.first().subscribe(doc => this.updateHostClassesForDoc(doc));
|
||||||
|
|
||||||
this.locationService.currentPath.subscribe(path => {
|
this.locationService.currentPath.subscribe(path => {
|
||||||
// Redirect to docs if we are in not in stable mode and are not hitting a docs page
|
// Redirect to docs if we are in archive mode and are not hitting a docs page
|
||||||
// (i.e. we have arrived at a marketing page)
|
// (i.e. we have arrived at a marketing page)
|
||||||
if (this.deployment.mode !== 'stable' && !/^(docs$|api|guide|tutorial)/.test(path)) {
|
if (this.deployment.mode === 'archive' && !/^(docs$|api|guide|tutorial)/.test(path)) {
|
||||||
this.locationService.replace('docs');
|
this.locationService.replace('docs');
|
||||||
}
|
}
|
||||||
if (path === this.currentPath) {
|
if (path === this.currentPath) {
|
||||||
|
|
Loading…
Reference in New Issue