-
Notifications
You must be signed in to change notification settings - Fork 451
refactor(socket): move all socket functions to lib/buddySocket.js #766
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
Conversation
Someone is attempting to deploy a commit to the dunsin's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Compliance Checks Passed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for getting this to come late.
But this is complete all socket functions are missing, the goal is to have a separation of concern
you can take inspiration from this PR: |
- Move socket-related functions from BuddyMatcher to buddySocket - Add reconnection attempt management in buddySocket - Extract long components in BuddyMatcher for better readability - Fix line length issues in both files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for reviewing this late, but it still doesn't move all the functions, i.e everything with a usecallback
hi @Ashaba123 still interested in it |
I thought moved every socket function. what is missing? |
i wonder function i have missed |
endSearch(currentChatId); | ||
}, []); | ||
|
||
const onConnect = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically everything that has a useCallback, like onConnect for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so i move everything that has a useCallback to BuddySocket. let me do that now
- Move all socket-related functions from BuddyMatcher.jsx to buddySocket.js - Create useSocketHandlers hook to manage all socket event handlers - Move socket event handlers and their memoization to buddySocket.js - Move socket reconnection logic to buddySocket.js - Improve code organization and separation of concerns - Enhance maintainability and reusability of socket functionality The changes centralize all socket-related logic in buddySocket.js while keeping BuddyMatcher.jsx focused on UI composition and component lifecycle management.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ashaba123 thanks so much for accommodating the changes, will do a live test next and see how it holds up.
But it looks good code wise
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
works good @Ashaba123, 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ππ½ |
Fixes #661
My PR closes #661
π¨βπ» Changes proposed
I moved all socket functions from
https://github.com/Dun-sin/Whisper/blob/dbec99c68f63c606647ea2cef1d458a72ae83b1b/client/src/components/BuddyMatcher.jsx and moved them into a file in lib folder called buddySocket.js.
βοΈ Check List (Check all the applicable boxes)
Note to reviewers
π· Screenshots