Browse Source

fix multiple bugs with query builder construction

Bug was caused by query string updates relying on q-str which is
only valid on initial render. Subsequent changes changes to query
caused bugs

fixes #10263, fixes #10264 and fixes #9159
Gabriel Horner 2 years ago
parent
commit
57e759aad1
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/main/frontend/components/query/builder.cljs

+ 2 - 2
src/main/frontend/components/query/builder.cljs

@@ -449,8 +449,8 @@
                                                  block (db/pull [:block/uuid (:block/uuid block)])]
                                                  block (db/pull [:block/uuid (:block/uuid block)])]
                                              (when block
                                              (when block
                                                (let [content (string/replace (:block/content block)
                                                (let [content (string/replace (:block/content block)
-                                                                             (util/format "{{query %s" q-str)
-                                                                             (util/format "{{query %s" q))]
+                                                                             #"\{\{query[^}]+\}\}"
+                                                                             (util/format "{{query %s}}" q))]
                                                  (editor-handler/save-block! repo (:block/uuid block) content)))))))
                                                  (editor-handler/save-block! repo (:block/uuid block) content)))))))
              (assoc state ::tree *tree)))
              (assoc state ::tree *tree)))
    :will-mount (fn [state]
    :will-mount (fn [state]