1

Om.Next is an excellent and clean UI library for use with Clojure and Clojurescript and I'm trying to add functionality for commenting to our website.

Essentially: entities have a bid (blurb-id) and now I want to add comments.

My idea is:

entities get a :cid (comment-id) and also they have the attributes :root_bid and :parent_cid

So every comment looks like:

{:cid         676767
 :root_bid    5252
 :parent_cid  676765
 :contents    "this is a comment"
 :author      "this@email.com"
 :total-score     70
 :number-of-votes 1 }

And that's basically everything I need to be able to store a comment.

So far so good, but now I want to recursively render comments, Fred comments on Jane's blurb, Jesus comments on Fred's comment, Josephine comments on Jesus' comment...

How can I recursively map comments using this datastructure?

I'm stumped so I appreciate any help.

sova
  • 5,468
  • 10
  • 40
  • 48
  • 1
    Did you see https://anmonteiro.com/2016/01/exploration-patterns-om-next-part-1/? I think you might need children attribute defined in your comment to be able to recursively query your recursive components. – Piotrek Bzdyl Apr 03 '17 at 20:22
  • 2
    Here's another link for recursion: https://anmonteiro.com/2016/01/om-next-query-syntax/. – Chris Murphy Apr 03 '17 at 23:01

0 Answers0