From 858fdbf31c9ddbf00eae692cd43e70455a19e1b5 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Sat, 10 Oct 2020 20:49:26 -0400
Subject: fixed docFilters to use up one string field, not 3.  makes
 adding/removing to lists incrementally work with new server code.

---
 src/client/views/search/SearchBox.tsx | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'src/client/views/search/SearchBox.tsx')

diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 019c703e0..c559d4eb7 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -122,22 +122,24 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
 
         const filters: string[] = [];
 
-        for (let i = 0; i < initialfilters.length; i = i + 3) {
-            if (initialfilters[i + 2] !== undefined) {
-                filters.push(initialfilters[i]);
-                filters.push(initialfilters[i + 1]);
-                filters.push(initialfilters[i + 2]);
+        for (let i = 0; i < initialfilters.length; i++) {
+            const fields = initialfilters[i].split(":");
+            if (fields[2] !== undefined) {
+                filters.push(fields[0]);
+                filters.push(fields[1]);
+                filters.push(fields[2]);
             }
         }
 
         const finalfilters: { [key: string]: string[] } = {};
 
-        for (let i = 0; i < filters.length; i = i + 3) {
-            if (finalfilters[filters[i]] !== undefined) {
-                finalfilters[filters[i]].push(filters[i + 1]);
+        for (let i = 0; i < filters.length; i = i++) {
+            const fields = filters[i].split(":");
+            if (finalfilters[fields[0]] !== undefined) {
+                finalfilters[fields[0]].push(fields[1]);
             }
             else {
-                finalfilters[filters[i]] = [filters[i + 1]];
+                finalfilters[fields[0]] = [fields[1]];
             }
         }
 
-- 
cgit v1.2.3-70-g09d2

