{"action":"closed","issue":{"url":"https://api.github.com/repos/opentok/opentok-react/issues/37","repository_url":"https://api.github.com/repos/opentok/opentok-react","labels_url":"https://api.github.com/repos/opentok/opentok-react/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/opentok/opentok-react/issues/37/comments","events_url":"https://api.github.com/repos/opentok/opentok-react/issues/37/events","html_url":"https://github.com/opentok/opentok-react/issues/37","id":341784394,"node_id":"MDU6SXNzdWUzNDE3ODQzOTQ=","number":37,"title":"getting errors on end call","user":{"login":"mohitgarg","id":14136405,"node_id":"MDQ6VXNlcjE0MTM2NDA1","avatar_url":"https://avatars2.githubusercontent.com/u/14136405?v=4","gravatar_id":"","url":"https://api.github.com/users/mohitgarg","html_url":"https://github.com/mohitgarg","followers_url":"https://api.github.com/users/mohitgarg/followers","following_url":"https://api.github.com/users/mohitgarg/following{/other_user}","gists_url":"https://api.github.com/users/mohitgarg/gists{/gist_id}","starred_url":"https://api.github.com/users/mohitgarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohitgarg/subscriptions","organizations_url":"https://api.github.com/users/mohitgarg/orgs","repos_url":"https://api.github.com/users/mohitgarg/repos","events_url":"https://api.github.com/users/mohitgarg/events{/privacy}","received_events_url":"https://api.github.com/users/mohitgarg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-17T06:37:00Z","updated_at":"2018-07-19T09:10:38Z","closed_at":"2018-07-19T09:10:37Z","author_association":"NONE","body":"```\r\nimport React, { Component } from 'react';\r\nimport { OTSession, OTStreams, preloadScript, OTPublisher, OTSubscriber } from 'opentok-react';\r\nimport { chrApi } from '../../api/api';\r\n\r\nclass SCOpenTok extends Component {\r\n  state = {\r\n    error: null,\r\n    connected: false,\r\n    apiKey: '',\r\n    sessionId: '',\r\n    token: '',\r\n  };\r\n\r\n  async componentDidMount() {\r\n    const obj = await chrApi('post', 'callpatient', { patientId: this.props.match.params.id });\r\n    this.setState({\r\n      apiKey: obj.data.apiKey,\r\n      sessionId: obj.data.sessionId,\r\n      token: obj.data.token,\r\n    });\r\n  }\r\n\r\n  sessionEvents = {\r\n    sessionConnected: () => {\r\n      this.setState({ connected: true });\r\n    },\r\n    sessionDisconnected: () => {\r\n      this.setState({ connected: false });\r\n    },\r\n  };\r\n  onError = err => {\r\n    this.setState({ error: `Failed to connect: ${err.message}` });\r\n  };\r\n\r\n  render() {\r\n    return (\r\n      <div className={'opentok'}>\r\n        {this.state.apiKey ? (\r\n          <OTSession\r\n            apiKey={this.state.apiKey}\r\n            sessionId={this.state.sessionId}\r\n            token={this.state.token}\r\n            eventHandlers={this.sessionEvents}\r\n            onError={this.onError}\r\n            onConnect={e => console.log(e, 'Connected Succesfully')}\r\n            ref={instance => {\r\n              this.otSession = instance;\r\n            }}\r\n            className={'opentok'}\r\n          >\r\n            <OTPublisher />\r\n            <OTStreams>\r\n              <OTSubscriber />\r\n            </OTStreams>\r\n          </OTSession>\r\n        ) : (\r\n          ''\r\n        )}\r\n        <button onClick={() => this.otSession.sessionHelper.disconnect(this.state.sessionId)}>\r\n          {' '}\r\n          End call\r\n        </button>\r\n      </div>\r\n    );\r\n  }\r\n}\r\n\r\nSCOpenTok.propTypes = {};\r\nSCOpenTok.defaultProps = {};\r\n\r\nexport default preloadScript(SCOpenTok);\r\n```\r\n\r\n**This is the route defined**\r\n\r\n\r\n```\r\n<Route\r\n          path={'/patient/:id/video'}\r\n          exact\r\n          component={cProps => (\r\n            <SCOpenTok\r\n              loadingDelegate={<div>Loading...</div>}\r\n              opentokClientUrl=\"https://static.opentok.com/v2/js/opentok.min.js\"\r\n              {...cProps}\r\n            />\r\n          )}\r\n        />\r\n\r\n```\r\n\r\n`Uncaught TypeError: Cannot read property 'off' of null\r\n    at OTSession.destroySession (OTSession.js?57c4:93)\r\n    at OTSession.componentWillUnmount (OTSession.js?57c4:60)\r\n    at callComponentWillUnmountWithTimer (react-dom.development.js?61bb:9703)\r\n    at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:100)\r\n    at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:138)\r\n    at invokeGuardedCallback (react-dom.development.js?61bb:187)\r\n    at safelyCallComponentWillUnmount (react-dom.development.js?61bb:9710)\r\n    at commitUnmount (react-dom.development.js?61bb:9956)\r\n    at commitNestedUnmounts (react-dom.development.js?61bb:9992)\r\n    at unmountHostComponents (react-dom.development.js?61bb:10279)`\r\n\r\n\r\nWhen ever I click on the end call and go back home or to any other route this error is popping up"}}
{"actor":{"display_login":"mohitgarg"}}