thematters / matters-server

Implementation of the Matters.Town API server
https://server.matters.town/playground
Apache License 2.0
76 stars 14 forks source link

Modeling subthreads #1541

Closed guoliu closed 2 years ago

guoliu commented 4 years ago

In the new design of comment section, 2nd level comments are bundled together based on reply relationships.

image


We can view the newly added structure as sections within subthreads, or as subthreads of subthreads that are flattened into the same level (level 3 flattened into level 2).

subthead 001

The structure on the left has subthreads with section, so subthreads are lists of comment list. It is more similar with the UI layout.

The structure on the right is fractal, with subthreads having their subthreads. It is more similar with the actually relationship of comments, which is a directed acyclic graph.

With the mental model on the right, we won't need to update our API, since Comment type has comments field. But we need to either resolve in API all remaining comments at level 3, or recursively call child comments of comments on frontend util no more comments are returned.

They both have pros and cons, but I think the right one is more concise and closer to the actual relationship of data.

robertu7 commented 4 years ago

Agree with the thought of the right one, data-driven may be more flexible for future product needs. Let's see how to optimize query performance.