perf: removed useEffect dependency, removed redundant socket emit #302
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.
apihub/examples/apps/chat-app/web/react-vite-tailwind/src/pages/chat.tsx (line 412): removed chats dependency from useEffect as it is actually not being used in any of the socket handlers, we are using updater function which is going to use the latest value of the chat, also having the chat as a dependecy also means that we will create and remove socket subscriptions every time the chats changes e.g. on receiving or sending new messages.
apihub/examples/apps/chat-app/web/react-vite-tailwind/src/pages/chat.tsx (line 360): removed a socket emit execution as it was already being called in getMessages function called next, the payload was also incorrect, resulting in the payload being undefined upon checking on the server