Skip to content

Commit 85a7385

Browse files
committed
empty where -> nil
1 parent 5e26bf7 commit 85a7385

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/cljs/vd_designer/pages/form/controller.cljs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,11 @@
365365
select)))))
366366

367367
(defn strip-empty-where-nodes [vd]
368-
(let [blank? #(and (%1 %2) (str/blank? (%1 %2)))]
369-
(update
370-
vd
371-
:where
372-
(fn [where]
373-
(remove #(blank? :path %) where)))))
368+
(let [blank? #(and (%1 %2) (str/blank? (%1 %2)))
369+
vd (update vd :where (fn [where] (remove #(blank? :path %) where)))]
370+
(if (seq (:where vd))
371+
vd
372+
(dissoc vd :where))))
374373

375374
(defn strip-empty-collections [vd]
376375
(medley/remove-kv

test/cljs/vd_designer/pages/form/controller_test.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@
336336
(deftest strip-empty-where-nodes-test
337337
(testing "strip empty where"
338338
(is (match?
339-
{:where []}
339+
{:where nil}
340340
(sut/strip-empty-where-nodes {:where []}))))
341341
(testing "strip non empty where with empty node"
342342
(is (match?
343-
{:where []}
343+
{:where nil}
344344
(sut/strip-empty-where-nodes {:where [{:path ""}]}))))
345345
(testing "strip non empty where with non empty node"
346346
(is (match?

0 commit comments

Comments
 (0)