浏览代码

fix: published file graph loading bugs

On startup of a published file graph, error notification displayed:
'read:Error: No protocol method Fs.readdir defined for type null' .
Came from :graph/ready event. Also was throwing console error '`Unknown Repo URL type:`'
Gabriel Horner 5 月之前
父节点
当前提交
e0632f0e25
共有 2 个文件被更改,包括 6 次插入4 次删除
  1. 2 1
      src/main/frontend/config.cljs
  2. 4 3
      src/main/frontend/handler/events.cljs

+ 2 - 1
src/main/frontend/config.cljs

@@ -424,7 +424,8 @@
 
     ;; nfs, browser-fs-access
     ;; Format: logseq_local_{dir-name}
-        (local-file-based-graph? repo-url)
+        (or (local-file-based-graph? repo-url)
+            (and publishing? (not db-based?)))
         (string/replace-first repo-url local-db-prefix "")
 
      ;; unit test

+ 4 - 3
src/main/frontend/handler/events.cljs

@@ -188,9 +188,10 @@
        (state/pub-event! [:mobile/post-init]))
      ;; FIXME: an ugly implementation for redirecting to page on new window is restored
      (repo-handler/graph-ready! repo)
-     (if db-based?
-       (export/auto-db-backup! repo {:backup-now? true})
-       (fs-watcher/load-graph-files! repo)))))
+     (when-not config/publishing?
+       (if db-based?
+         (export/auto-db-backup! repo {:backup-now? true})
+         (fs-watcher/load-graph-files! repo))))))
 
 (defmethod handle :instrument [[_ {:keys [type payload] :as opts}]]
   (when-not (empty? (dissoc opts :type :payload))