1
0
Эх сурвалжийг харах

fix: graphs disappeared after restarting the app

Tienson Qin 4 жил өмнө
parent
commit
ab84fe7032

+ 5 - 1
src/main/frontend/handler/file.cljs

@@ -157,7 +157,11 @@
                    (p/let [delete-blocks (db/delete-file-blocks! repo-url file)
                            [pages blocks] (extract-handler/extract-blocks-pages repo-url file content utf8-content)
                            _ (when-let [current-file (page-exists-in-another-file (first pages) file)]
-                               (p/rejected (str "Page already exists with another file: " current-file)))
+                               (let [error (str "Page already exists with another file: " current-file)]
+                                 (state/pub-event! [:notification/show
+                                                    {:content error
+                                                     :status :error
+                                                     :clear? false}])))
                            blocks (remove-non-exists-refs! blocks)
                            block-ids (map (fn [block] {:block/uuid (:block/uuid block)}) blocks)
                            pages (extract-handler/with-ref-pages pages blocks)]

+ 2 - 1
src/main/frontend/handler/web/nfs.cljs

@@ -178,7 +178,8 @@
                              (and ok-handler (ok-handler))
                              (when (util/electron?)
                                (fs/watch-dir! dir-name))
-                             (state/pub-event! [:graph/added repo])))))
+                             (state/pub-event! [:graph/added repo])
+                             (db/persist! repo)))))
                (p/catch (fn [error]
                           (log/error :nfs/load-files-error repo)
                           (log/error :exception error)))))))