Skip to content
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

Cannot read property 'getWrappedInstance' of null when unmounting Chat component #866

Closed
jramcast opened this issue Feb 21, 2018 · 3 comments
Assignees
Milestone

Comments

@jramcast
Copy link

jramcast commented Feb 21, 2018

Uncaught TypeError: Cannot read property 'getWrappedInstance' of null
at Chat.saveHistoryRef (app.bundle.js:4408)
at detachRef (app.bundle.js:20390)
at Object.ReactRef.detachRefs (app.bundle.js:20445)
at Object.unmountComponent (app.bundle.js:4092)
at Object.unmountChildren (app.bundle.js:24781)
at ReactDOMComponent.unmountChildren (app.bundle.js:24554)
at ReactDOMComponent.unmountComponent (app.bundle.js:22872)
at Object.unmountComponent (app.bundle.js:4093)
at ReactCompositeComponentWrapper.unmountComponent (app.bundle.js:25211)
at Object.unmountComponent (app.bundle.js:4093)

I get this error when trying to unmount the React Chat component. The error occurs at the saveHistoryRef function because the passed historyWrapper is null:

Chat.prototype.saveHistoryRef = function (historyWrapper) {
        this.historyRef = historyWrapper.getWrappedInstance();
};

This simple code generates the error.

ReactDOM.render(
  <Chat
    directLine={{ secret: '...' }}
    user={{ id: 'agent1', name: 'agent1' }}
  />,
  document.getElementById('app')
 );

setTimeout(
  () => {
    ReactDOM.unmountComponentAtNode(document.getElementById('app'));
  },
  2000
);

Can we add a null check, like in #782 ?

@HernanCote
Copy link

Any news on this issue?

@eanders-ms
Copy link
Contributor

@compulim Could you please have a look?

@compulim
Copy link
Contributor

compulim commented Mar 7, 2018

@HernanCote it's coming in PR #884.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants