lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Performance: Remove duplicated information from /api/v3/comment/list

Open drumlinish opened this issue 2 years ago • 2 comments

Requirements

  • [X] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • [X] Did you check to see if this issue already exists?
  • [X] Is this only a feature request? Do not put multiple feature requests in one issue.
  • [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Is your proposal related to a problem?

The endpoint returns a lot of duplicated information since each comment has "post" and "community" objects with the same information.

Example: compare of the JSON of two comments: image

https://github.com/LemmyNet/lemmy/blob/0c82f4e66065b5772fede010a879d327135dbb1e/src/api_routes_http.rs#L232

https://github.com/LemmyNet/lemmy/blob/0c82f4e66065b5772fede010a879d327135dbb1e/crates/db_views/src/comment_view.rs#L121-L132

Describe the solution you'd like.

Remove the "post" and "community" objects from the comments when returned from the endpoint or in the database query. There may be users of the information that would need to be updated.

Describe alternatives you've considered.

Replace the full objects with ID's.

Additional context

No response

drumlinish avatar Jul 07 '23 15:07 drumlinish

I brought up the idea of using a GraphQL API or a REST API that allows clients to specify the fields they want as other possible solutions for this issue in the dev matrix room. It could be worth considering since it would avoid needing to make multiple requests to fetch information for the related creator, post, etc. There are a couple of different ways to skin this cat.

SleeplessOne1917 avatar Jul 08 '23 16:07 SleeplessOne1917

#2862

I fully believe this is the only solution to the current API woes. The API is even currently designed as if it were expecting to be GraphQL

bqv avatar Jul 08 '23 21:07 bqv

Same as https://github.com/LemmyNet/lemmy/issues/2957

Nutomic avatar Mar 14 '24 15:03 Nutomic