From 89ab06ffe6709e8876b98aba7a30da7ac67278b2 Mon Sep 17 00:00:00 2001
From: Etienne LOUPIAS <eloupias@grandlyon.com>
Date: Mon, 5 Jun 2023 12:15:20 +0000
Subject: [PATCH] fix(orientation): old filters must not be kept when changing
 orientation filters

---
 .../structure-list-search.component.ts                   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts b/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts
index 012776794..25fbe350b 100644
--- a/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts
+++ b/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts
@@ -109,8 +109,13 @@ export class StructureListSearchComponent implements OnInit {
 
   //Update url with new params added or removed
   public updateUrlParams(filters: Filter[]): void {
-    // No url update if the page is displaying structure details, because it must keep the url with the structure id
-    if (this.activatedRoute.snapshot.queryParams['id'] && filters.length === 0) return;
+    // No url update if the page is displaying structure details, because it must keep the url with the structure id, neither for orientation
+    if (
+      (this.activatedRoute.snapshot.queryParams['id'] && filters.length === 0) ||
+      this.router.url.startsWith('/orientation')
+    ) {
+      return;
+    }
 
     let queryString = [];
     filters.forEach((elt) => {
-- 
GitLab