MCPcopy Create free account
hub / github.com/CommE2E/comm / componentDidUpdate

Method componentDidUpdate

lib/socket/socket.react.js:309–329  ·  view source on GitHub ↗
(prevProps: Props)

Source from the content-addressed store, hash-verified

307 }
308
309 componentDidUpdate(prevProps: Props) {
310 if (this.props.active && !prevProps.active) {
311 this.openSocket('connecting');
312 } else if (!this.props.active && prevProps.active) {
313 this.closeSocket(!!prevProps.activeThread);
314 } else if (
315 this.props.active &&
316 prevProps.openSocket !== this.props.openSocket
317 ) {
318 // This case happens when the baseURL/urlPrefix is changed
319 this.reopenConnectionAfterClosing = true;
320 this.forceCloseSocket();
321 } else if (
322 this.props.active &&
323 this.props.connection.status === 'disconnected' &&
324 prevProps.connection.status !== 'disconnected' &&
325 !this.props.activeSessionRecovery
326 ) {
327 this.reconnect();
328 }
329 }
330
331 render(): React.Node {
332 // It's important that APIRequestHandler get rendered first here. This is so

Callers

nothing calls this directly

Calls 3

openSocketMethod · 0.95
closeSocketMethod · 0.95
forceCloseSocketMethod · 0.95

Tested by

no test coverage detected