refactor: move socket emit/on methods to useChatUtils hook #709
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes Issue
My PR closes #664
π¨βπ» Changes proposed(What did you do ?)
emit
andon
methods) from theChat
component to theuseChatUtils
hook.setupSocketListeners
function inuseChatUtils
to handle all socket event listeners (NEW_EVENT_RECEIVE_MESSAGE
,NEW_EVENT_DELETE_MESSAGE
, etc.) and cleanup.Chat
component to use the refactored methods fromuseChatUtils
.βοΈ Check List (Check all the applicable boxes)
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