 
 
 "-----------------------------------------------------------
-(update-all-views-for-query  query  )
+(update-all-data-windows-for-query  query  )
 
 
 
 
 -----------------------------------------------------------"
-(defn update-all-views-for-query [ query-key ]
+(defn update-all-data-windows-for-query [ query-key ]
 
   (let [
-          data-query-atom      (get @client-query-cache    query-key)
-          data-query           (if data-query-atom      @data-query-atom)
-          list-of-views-atom   (if data-query           (get data-query  :list-of-data-window-keys))
-          list-of-views        (if list-of-views-atom   @list-of-views-atom)
+          data-query-atom             (get  @client-query-cache  query-key)
+          data-query                  (if data-query-atom             @data-query-atom)
+          list-of-data-windows-atom   (if data-query                  (get data-query  :list-of-data-window-keys))
+          list-of-data-windows        (if list-of-data-windows-atom   @list-of-data-windows-atom)
           ]
 
-    (if list-of-views
+    (if list-of-data-windows
       (doall
        (map
-        (fn[view-key]
-          (update-data-window-for-query  view-key  query-key))
-        list-of-views )))))
+        (fn[data-window-key] (update-data-window-for-query  data-window-key   query-key))
+        list-of-data-windows )))))
 
 
 

-----------------------------------------------------------"
(defn  add-data-query-watch-v2 [ query-key ]

  (let [  data-query-atom       (get @client-query-cache  query-key)
          list-of-views-atom    (get @data-query-atom  :list-of-data-window-keys)       ]


    ; this says that whenever the list of views changes then update all of the views. This
    ; is a bit much, as really only the added views need to be updated
    (add-watch list-of-views-atom
               (merge query-key {:type "views"})
               (fn [_ _ old-val new-val]
                 ;(js/alert (pr-str "new view: " new-val))
                 (update-all-views-for-query   query-key)
                 ))

    ; this says that whenever the query information changes then see if
    ; we need to get any more information from the database

                              )))
                       )

                       (update-all-data-windows-for-query   query-key)

                       ))

