From 5e26bf4c0252c768c5aa2b6d23f9da0b25c2c177 Mon Sep 17 00:00:00 2001
From: BrittainJackson7 <brittainjackson7@gmail.com>
Date: Fri, 10 Nov 2023 11:25:53 -0700
Subject: [PATCH] Fix bug that transfers queryable selections across
 collections

---
 src/components/presentational/FootprintResults.jsx     | 4 ++++
 src/components/presentational/SearchAndFilterInput.jsx | 6 ++++++
 src/components/presentational/Sidebar.jsx              | 3 ++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/components/presentational/FootprintResults.jsx b/src/components/presentational/FootprintResults.jsx
index 60b4ec317..0cad69dfc 100644
--- a/src/components/presentational/FootprintResults.jsx
+++ b/src/components/presentational/FootprintResults.jsx
@@ -68,6 +68,8 @@ export default function FootprintResults(props) {
     // Call the callback function to pass the selected title to the Sidebar
     props.updateSelectedTitle(selectedCollectionTitle);
 
+    props.UpdateQueryableTitles(null);
+
 
     // Send to Leaflet
     window.postMessage(["setVisibleCollections", newCollectionId], "*");
@@ -203,6 +205,7 @@ export default function FootprintResults(props) {
 
         }
 
+
         // Updates collectionId if switching to a new set of collections (new target)
         let myId = collectionId;
         if (!collections[myId]) {
@@ -217,6 +220,7 @@ export default function FootprintResults(props) {
         setHasFootprints(Object.keys(collections).length > 0);
         setIsLoading(false);
 
+
        
 
         // Send to Leaflet
diff --git a/src/components/presentational/SearchAndFilterInput.jsx b/src/components/presentational/SearchAndFilterInput.jsx
index ceec8f7c3..2a27c7256 100644
--- a/src/components/presentational/SearchAndFilterInput.jsx
+++ b/src/components/presentational/SearchAndFilterInput.jsx
@@ -227,6 +227,10 @@ export default function SearchAndFilterInput(props) {
     UpdateQueryableTitles(selectedOptionsWithValues);
   };
 
+  //queryables
+  const handleQueryableRemove = (event) => {
+    UpdateQueryableTitles(event);
+  };
 
   // Sorting
   const handleSortChange = (event) => {
@@ -296,6 +300,8 @@ export default function SearchAndFilterInput(props) {
   setAreaTextVal("");    // Area (received by window message from AstroMap)
   setDateFromVal(null); // From Date
   setDateToVal(null);  // To Date
+  handleQueryableRemove(null); // properties selection
+  
 
   }, [props.targetName]);
 
diff --git a/src/components/presentational/Sidebar.jsx b/src/components/presentational/Sidebar.jsx
index d362dd990..6e26f8346 100644
--- a/src/components/presentational/Sidebar.jsx
+++ b/src/components/presentational/Sidebar.jsx
@@ -80,8 +80,9 @@ export default function Sidebar(props) {
             filterString={filterString}
             queryAddress={props.queryAddress}
             setQueryAddress={props.setQueryAddress}
-            updateSelectedTitle={updateSelectedTitle} 
+            updateSelectedTitle={updateSelectedTitle}
             selectedQueryables = {updatedQueryableTitles}
+            UpdateQueryableTitles = {UpdateQueryableTitles}
           />
         </Collapse>
       </div>
-- 
GitLab