Skip to main content

Clips — Technical Reference

← Back to Clips

Where this lives

Backend

A clip is not a distinct model — it's a Post with type: 'clip', set at creation time when the post has exactly one video attachment and no images. There is no separate "Clip" GraphQL type; clips returns ordinary Post objects.

Frontend

Technical implementation checklist

  • clips query — wired end-to-end; ClipsPage.tsx (authenticated) and PublicClipsPage.tsx (logged-out, public-only)
  • Like / unlike — wired; shares PostCard.tsx's hasUserLikedPost/likePost mutations
  • Save / unsave — wired; shares isPostSaved/savePost mutations
  • Repost / undo repost — wired; shares hasUserReposted/repostPost/undoRepost mutations
  • Comment — wired via the shared PostModal.tsx
  • Dedicated Clips creation UI (record/upload camera flow) — Fixed this session: CreateClipModal.tsx is fully built and now mounted on ClipsPage.tsx behind a "Create clip" FAB; clips can still also be produced by the regular post composer (CreatePostModal.tsx) when a single video is attached

Feed query

query GetClips($limit: Int, $offset: Int) {
clips(limit: $limit, offset: $offset) {
id
text
userId
createdAt
user { id username profilePicture }
media { id mediaUrl mediaType width height }
}
}

ClipsPage.tsx follows the same optimistic-toggle pattern as PostCard.tsx for like/save/repost — it queries the current state (hasUserLikedPost, isPostSaved, hasUserReposted) per visible clip and updates local state immediately on tap, before the mutation resolves.