Skip to content

REFACTOR: Decomposed Hooks - #130

Merged
mbeps merged 11 commits into
mainfrom
dev
Dec 7, 2025
Merged

REFACTOR: Decomposed Hooks#130
mbeps merged 11 commits into
mainfrom
dev

Conversation

@mbeps

@mbeps mbeps commented Dec 7, 2025

Copy link
Copy Markdown
Owner

This pull request refactors the application's hooks structure by reorganizing them into more specific subdirectories based on feature domains (such as community, posts, comments, and admin). The changes update all relevant imports and usages throughout the codebase to use the new hook locations and, where appropriate, split monolithic hooks into more focused, single-responsibility hooks for improved maintainability and clarity.

Hooks organization and import updates:

Hooks splitting and single-responsibility refactor:

  • Several previously monolithic hooks (such as usePosts, useComments, useCommunityData, and useAdmins) have been split into more focused hooks (e.g., usePostState, usePostVote, usePostDeletion, useCommentList, useCreateComment, useDeleteComment, useCommunityState, useCommunityMembershipActions, useAdminList, useAddAdmin, etc.), improving separation of concerns and code clarity. (app/community/[communityId]/comments/[pid]/PostClientPage.tsxL35-R42, [1] [2] [3] [4] [5] [6] [7] [8] [9]

Type and usage updates:

  • Types and usages have been updated to reflect the new hook structures, such as importing Comment from hooks/comments/types instead of from the old comments hook, and updating props and destructuring to use the new hooks' APIs. [1] [2] [3]

Feature-specific improvements:

  • Admin management logic has been split into distinct hooks for listing, adding, searching, and removing admins, and usages have been updated to provide correct state setters where needed. [1] [2] [3]
  • Community settings logic has been separated into hooks for image management, privacy management, and deletion, clarifying responsibilities and simplifying component code.

General codebase maintainability:

@vercel

vercel Bot commented Dec 7, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
circus-discussion Ready Ready Preview Comment Dec 7, 2025 8:04pm

@mbeps
mbeps merged commit 183a0d0 into main Dec 7, 2025
5 checks passed
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