Merge pull request #1366 from atmire/w2p-84385_tabbed-view-breaks-on-tab-change

84385: Tabbed search view breaks if switch away/back between tabs
This commit is contained in:
Tim Donohue
2021-10-20 17:09:31 -05:00
committed by GitHub
2 changed files with 1 additions and 21 deletions

View File

@@ -55,10 +55,4 @@ describe('ConfigurationSearchPageComponent', () => {
expect(routeService.setParameter).toHaveBeenCalledWith('fixedFilterQuery', QUERY); expect(routeService.setParameter).toHaveBeenCalledWith('fixedFilterQuery', QUERY);
}); });
it('should reset route parameters on destroy', () => {
fixture.destroy();
expect(routeService.setParameter).toHaveBeenCalledWith('configuration', undefined);
expect(routeService.setParameter).toHaveBeenCalledWith('fixedFilterQuery', undefined);
});
}); });

View File

@@ -6,7 +6,6 @@ import {
Component, Component,
Inject, Inject,
Input, Input,
OnDestroy,
OnInit OnInit
} from '@angular/core'; } from '@angular/core';
import { pushInOut } from '../shared/animations/push'; import { pushInOut } from '../shared/animations/push';
@@ -34,7 +33,7 @@ import { Router } from '@angular/router';
] ]
}) })
export class ConfigurationSearchPageComponent extends SearchComponent implements OnInit, OnDestroy { export class ConfigurationSearchPageComponent extends SearchComponent implements OnInit {
/** /**
* The configuration to use for the search options * The configuration to use for the search options
* If empty, the configuration will be determined by the route parameter called 'configuration' * If empty, the configuration will be determined by the route parameter called 'configuration'
@@ -72,17 +71,4 @@ export class ConfigurationSearchPageComponent extends SearchComponent implements
this.routeService.setParameter('fixedFilterQuery', this.fixedFilterQuery); this.routeService.setParameter('fixedFilterQuery', this.fixedFilterQuery);
} }
} }
/**
* Reset the updated query/configuration set in ngOnInit()
*/
ngOnDestroy(): void {
super.ngOnDestroy();
if (hasValue(this.configuration)) {
this.routeService.setParameter('configuration', undefined);
}
if (hasValue(this.fixedFilterQuery)) {
this.routeService.setParameter('fixedFilterQuery', undefined);
}
}
} }