-
Notifications
You must be signed in to change notification settings - Fork 86
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
LIQ-732: POC websocket client #375
Conversation
77f2a35
to
c8624c5
Compare
0530304
to
a346192
Compare
@@ -104,6 +109,22 @@ export const Drops: React.FC<DropsProps> = ({ candyShop, wallet, walletConnectCo | |||
}); | |||
}; | |||
|
|||
// socket | |||
useEffect(() => { | |||
const controllers = [ |
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.
Curious, we declare the controllers
here, wouldn't the reference will be changed every time once component renders, so the purpose here is we need to add the listeners and clean the listeners every time when component is being mounting / unmounting?
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.
actually, removeControllers will be run every time useEffect re-run. If we dont remove controllers at that time, the listeners are stil there and we will have more than 1 listeners for 1 event, the result maybe we will add duplicate item to list and display on UI, or some unexpected results. So better just clean it every useEffect re-run or unmount phase.
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.
okay, that sounds good and it's the desired result we want to avoid heap grows.
a346192
to
c2887b6
Compare
socket auction integrate auction, order, drop remove polling code remove unused code upadte comment update env websocket add socket url and trade event for sell
846dbb2
to
c2e9549
Compare
No description provided.