@ecodev/natural 63.4.0 → 63.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3813,17 +3813,18 @@ class NaturalAbstractList extends NaturalAbstractPanel {
|
|
|
3813
3813
|
this.variablesManager.defaults('sorting', { sorting: this.defaultSorting });
|
|
3814
3814
|
this.dataSource = new NaturalDataSource(this.getDataObservable());
|
|
3815
3815
|
this.selection.clear();
|
|
3816
|
+
this.handleHistoryNavigation();
|
|
3817
|
+
}
|
|
3818
|
+
handleHistoryNavigation() {
|
|
3816
3819
|
// Update natural search when history changes (back/forward buttons)
|
|
3817
3820
|
// History state is detectable only on NavigationStart (popstate trigger)
|
|
3818
3821
|
// But we need parameters from url after NavigationEnd. So proceed in two steps with a flag.
|
|
3819
3822
|
let isPopState = false;
|
|
3820
3823
|
this.router.events
|
|
3821
3824
|
.pipe(takeUntilDestroyed(this.destroyRef), filter(event => event instanceof NavigationStart && event.navigationTrigger === 'popstate'))
|
|
3822
|
-
.subscribe(() =>
|
|
3823
|
-
isPopState = true;
|
|
3824
|
-
});
|
|
3825
|
+
.subscribe(() => (isPopState = true));
|
|
3825
3826
|
this.router.events
|
|
3826
|
-
.pipe(takeUntilDestroyed(this.destroyRef), filter(event => event instanceof NavigationEnd && isPopState))
|
|
3827
|
+
.pipe(takeUntilDestroyed(this.destroyRef), filter(event => event instanceof NavigationEnd && isPopState), filter(() => this.historyNavigationFilter()))
|
|
3827
3828
|
.subscribe(() => {
|
|
3828
3829
|
isPopState = false; // reset flag
|
|
3829
3830
|
const selections = fromUrl(this.persistenceService.getFromUrl('ns', this.route));
|
|
@@ -3831,6 +3832,9 @@ class NaturalAbstractList extends NaturalAbstractPanel {
|
|
|
3831
3832
|
this.search(selections);
|
|
3832
3833
|
});
|
|
3833
3834
|
}
|
|
3835
|
+
historyNavigationFilter() {
|
|
3836
|
+
return true;
|
|
3837
|
+
}
|
|
3834
3838
|
/**
|
|
3835
3839
|
* Persist search and then launch whatever is required to refresh the list
|
|
3836
3840
|
*/
|