diff --git a/web/src/main/frontend/components/page.cljs b/web/src/main/frontend/components/page.cljs index 3b2571862..532008128 100644 --- a/web/src/main/frontend/components/page.cljs +++ b/web/src/main/frontend/components/page.cljs @@ -59,7 +59,7 @@ (if (and sidebar? (empty? raw-page-headings)) (do (state/sidebar-remove-block! (:sidebar/idx option)) - [:div "Deleted"]) + [:div "Empty"]) (let [page-name (if heading? (:page/name (db/entity repo (:db/id (:heading/page (first raw-page-headings))))) page-name) diff --git a/web/src/main/frontend/db.cljs b/web/src/main/frontend/db.cljs index 6214c2b92..e86943647 100644 --- a/web/src/main/frontend/db.cljs +++ b/web/src/main/frontend/db.cljs @@ -289,33 +289,32 @@ current-tag (get-current-tag) current-page-id (get-current-page-id) {:heading/keys [page]} (first headings) - handler-keys (when-let [page-id (:db/id page)] - (->> - (util/concat-without-nil - (map - (fn [heading] - [:headings (:heading/uuid heading)]) - headings) + handler-keys (->> + (util/concat-without-nil + (mapcat + (fn [heading] + (let [page-id (:db/id (:heading/page heading))] + [[:headings (:heading/uuid heading)] + [:page/headings page-id] + [:page/ref-pages page-id]])) + headings) - ;; affected tag - (when current-tag - [[:tag/ref-headings current-tag]]) + ;; affected tag + (when current-tag + [[:tag/ref-headings current-tag]]) - ;; affected page - [ - [:page/headings page-id] - [:page/ref-pages page-id] - [:page/ref-pages current-page-id] + (when current-page-id + [[:page/ref-pages current-page-id] [:page/refed-headings current-page-id] - [:page/mentioned-pages current-page-id]] + [:page/mentioned-pages current-page-id]]) - ;; refed-pages - (apply concat - (for [{:heading/keys [ref-pages]} headings] - (map (fn [page] - [:page/refed-headings (:db/id page)]) - ref-pages)))) - (distinct))) + ;; refed-pages + (apply concat + (for [{:heading/keys [ref-pages]} headings] + (map (fn [page] + [:page/refed-headings (:db/id page)]) + ref-pages)))) + (distinct)) refed-pages (map (fn [[k page-id]] (if (= k :page/refed-headings) diff --git a/web/src/main/frontend/handler.cljs b/web/src/main/frontend/handler.cljs index 8093c7dc6..9c0dd03fa 100644 --- a/web/src/main/frontend/handler.cljs +++ b/web/src/main/frontend/handler.cljs @@ -1381,10 +1381,10 @@ {:key :heading/change :data heading-changes} [[path new-file-content]])) - ;; (alter-file to-heading-repo - ;; path - ;; new-file-content - ;; {:re-render-root? true}) + (alter-file to-heading-repo + path + new-file-content + {:re-render-root? true}) )) ;; same repo but different files @@ -1450,7 +1450,7 @@ to-after-headings modified-time) {:key :heading/change - :data (conj heading-changes to-heading)} + :data (conj heading-changes target-heading)} [[target-file-path new-target-file-content] [to-file-path new-to-file-content]])))