Browse Source

fix: temporal validation for the current graph's config

related to #7794, #7795
Tienson Qin 3 năm trước cách đây
mục cha
commit
ae77281f47
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      src/main/frontend/state.cljs

+ 8 - 3
src/main/frontend/state.cljs

@@ -330,6 +330,11 @@
              new))
              new))
          configs))
          configs))
 
 
+(defn validate-current-config
+  "TODO: Temporal fix"
+  [config]
+  (when (map? config) config))
+
 (defn get-config
 (defn get-config
   "User config for the given repo or current repo if none given. All config fetching
   "User config for the given repo or current repo if none given. All config fetching
 should be done through this fn in order to get global config and config defaults"
 should be done through this fn in order to get global config and config defaults"
@@ -339,7 +344,7 @@ should be done through this fn in order to get global config and config defaults
    (merge-configs
    (merge-configs
     default-config
     default-config
     (get-in @state [:config ::global-config])
     (get-in @state [:config ::global-config])
-    (get-in @state [:config repo-url]))))
+    (validate-current-config (get-in @state [:config repo-url])))))
 
 
 (defonce publishing? (atom nil))
 (defonce publishing? (atom nil))
 
 
@@ -551,10 +556,10 @@ Similar to re-frame subscriptions"
   "Sub equivalent to get-config which should handle all sub user-config access"
   "Sub equivalent to get-config which should handle all sub user-config access"
   ([] (sub-config (get-current-repo)))
   ([] (sub-config (get-current-repo)))
   ([repo]
   ([repo]
-   (let [config (sub :config)]
+   (let [config (validate-current-config (sub :config))]
      (merge-configs default-config
      (merge-configs default-config
                     (get config ::global-config)
                     (get config ::global-config)
-                    (get config repo)))))
+                    (validate-current-config (get config repo))))))
 
 
 (defn enable-grammarly?
 (defn enable-grammarly?
   []
   []