mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 23:19:38 +00:00
re-render root after new db created
This commit is contained in:
@@ -186,7 +186,7 @@
|
||||
(if (or (nfs-handler/supported?) (mobile-util/native-platform?))
|
||||
{:title (t :new-graph) :options {:on-click #(state/pub-event! [:graph/setup-a-repo])}}
|
||||
{:title (t :new-graph) :options {:href (rfe/href :repos)}}) ;; Brings to the repos page for showing fallback message
|
||||
{:title (str (t :new-graph) "- DB version")
|
||||
{:title (str (t :new-graph) " - DB version")
|
||||
:options {:on-click #(state/pub-event! [:graph/new-db-graph])}}
|
||||
{:title (t :all-graphs) :options {:href (rfe/href :repos)}}
|
||||
refresh-link
|
||||
@@ -248,14 +248,21 @@
|
||||
(rum/defcs new-db-graph <
|
||||
(rum/local "" ::graph-name)
|
||||
[state]
|
||||
(let [*graph-name (::graph-name state)]
|
||||
(let [*graph-name (::graph-name state)
|
||||
new-db-f (fn []
|
||||
(when-not (string/blank? @*graph-name)
|
||||
(repo-handler/new-db! @*graph-name)
|
||||
(state/close-modal!)))]
|
||||
[:div.new-graph.p-4
|
||||
[:h1.title "Create new graph: "]
|
||||
[:input.form-input.mb-4 {:value @*graph-name
|
||||
:auto-focus true
|
||||
:on-change #(reset! *graph-name (util/evalue %))}]
|
||||
(ui/button
|
||||
"Submit"
|
||||
:on-click (fn []
|
||||
(when-not (string/blank? @*graph-name)
|
||||
(repo-handler/new-db! @*graph-name))))]))
|
||||
:on-change #(reset! *graph-name (util/evalue %))
|
||||
:on-key-down (fn [^js e]
|
||||
(when (= (gobj/get e "key") "Enter")
|
||||
(new-db-f)))}]
|
||||
(ui/button "Submit"
|
||||
:on-click new-db-f
|
||||
:on-key-down (fn [^js e]
|
||||
(when (= (gobj/get e "key") "Enter")
|
||||
(new-db-f))))]))
|
||||
|
||||
@@ -551,5 +551,7 @@
|
||||
_ (db/transact! full-graph-name initial-data)
|
||||
_ (repo-config-handler/set-repo-config-state! full-graph-name config/config-default-content)
|
||||
;; TODO: handle global graph
|
||||
|
||||
_ (state/pub-event! [:page/create (date/today) {:redirect? false}])]
|
||||
(js/setTimeout ui-handler/re-render-root! 100)
|
||||
(prn "New db created: " full-graph-name)))
|
||||
|
||||
Reference in New Issue
Block a user