Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move socket emit/on methods to useChatUtils hook #709

Merged
merged 3 commits into from
Oct 20, 2024

Conversation

azr-arch
Copy link
Contributor

Fixes Issue

My PR closes #664

πŸ‘¨β€πŸ’» Changes proposed(What did you do ?)

  • Moved all socket-related logic (both emit and on methods) from the Chat component to the useChatUtils hook.
  • Created a setupSocketListeners function in useChatUtils to handle all socket event listeners (NEW_EVENT_RECEIVE_MESSAGE, NEW_EVENT_DELETE_MESSAGE, etc.) and cleanup.
  • Updated the Chat component to use the refactored methods from useChatUtils.

βœ”οΈ Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.

Note to reviewers

πŸ“· Screenshots

https://github.com/user-attachments/assets/ce4bbf0b-f63c-4a83-842b-2bfb47b09a6a
https://github.com/user-attachments/assets/d409ac3d-e39b-4e1a-a901-cabc6340023b

Copy link

vercel bot commented Oct 19, 2024

@azr-arch is attempting to deploy a commit to the dunsin's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Oct 20, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
whisper-b2p2 βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Oct 20, 2024 6:53am

Copy link
Owner

@Dun-sin Dun-sin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did great, thanks for contributing, I hope you will stick around and continue to contribute to this project.

Consider giving this project a star, sharing the project with your friends, and joining the community discord server if you haven't for more resources and opportunities to connect with others. πŸ‘‰πŸ½hereπŸ‘ˆπŸ½

@Dun-sin Dun-sin merged commit d342c4f into Dun-sin:main Oct 20, 2024
3 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.

[OTHER] move all socket function in chat.jsx into chatSocket.js
2 participants