Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: block properties #2189

Merged
merged 12 commits into from
Jun 17, 2022
Merged

feat: block properties #2189

merged 12 commits into from
Jun 17, 2022

Conversation

filipesilva
Copy link
Collaborator

@filipesilva filipesilva commented May 10, 2022

No description provided.

@vercel
Copy link

vercel bot commented May 10, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
athens ✅ Ready (Inspect) Visit Preview Jun 17, 2022 at 9:07AM (UTC)


;; TODO: generalize and use athens.self-hosted.migrate to migrate existing datascript dbs
;; For now (the prototyping stage) it is enough that only new servers can use the new schema.
(def schema (merge v1-schema v2-schema))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: this PR cannot be merged before we have a migration set up for existing datascript dbs.

@@ -152,62 +174,79 @@
(:page/sidebar)))


(defn get-children-uids-recursively
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this function was moved further down in the namespace.

(d/pull db '[:block/order :block/uid {:block/children ...}])
(tree-seq :block/children :block/children)
(map :block/uid))))
(defn sort-block-children
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this function was moved up within the namespace.

.carve/ignore Outdated Show resolved Hide resolved
@@ -31,12 +35,15 @@
(let [db common-db/empty-db]
(is (= [#:op{:type :page/new, :atomic? true, :args {:page/title "Welcome"}}
#:op{:type :block/new, :atomic? true, :args {:block/uid "block-1", :block/position {:page/title "Welcome", :relation :last}}}
#:op{:type :page/new, :atomic? true, :args {:page/title "Welcome"}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the IR algo to not produce duplicate operations.

(bfs/internal-representation->atomic-ops db tree-with-page nil)))

(is (= [#:op{:type :block/new, :atomic? true, :args {:block/uid "eaa4c9435", :block/position {:page/title "title", :relation :first}}}
(is (= [#:op{:type :page/new, :atomic? true, :args #:page{:title "title"}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IR now creates the location because of the changes in src/cljc/athens/common_events/graph/ops.cljc. I think this is correct.

New version offers feature parity with clojure 1.11.
We use some of the 1.11 features in clojure so we need parity to use
them in cljc files.
After updating to cljc 1.11.51 I started seeing some shadow-cljs errors
while running java code.
(map :db/id)
(map (partial common-db/get-parent db))
(mapcat (fn [{:block/keys [properties]}]
(println properties)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: debug code

@filipesilva filipesilva marked this pull request as ready for review June 17, 2022 08:58
@filipesilva filipesilva merged commit 7434452 into athensresearch:main Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant