-
Notifications
You must be signed in to change notification settings - Fork 555
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
Unable to destroy Lock instance #907
Comments
@sandrinodimattia can you share more about this? what lock version, how are you instantiating lock, how are you calling lock.show()? |
I can repro this. We'll fix this eventually. Since it's not a documented API, I'm assigning this with a low priority |
Hey @luisrudge, just landed on this thread from March 2017 and was wondering if This seems to be specially useful in React apps to avoid memory leaks. Example: import Auth0Lock from 'auth0-lock';
export class MyComponent extends React.Component {
constructor() {
super();
this.state = {
lock: null,
};
}
componentWillUnmount() {
const { lock } = this.state;
if (lock) {
lock.destroy();
}
}
componentDidMount() {
const lock = new Auth0Lock(clientID, domain, options);
lock.show();
this.setState({ lock });
}
render() {
// ...
}
} When I try to implement the trigger above, the following error pops up: Dynamic page loading failed TypeError: Cannot read property 'getIn' of undefined
at eval (data_utils.js:20)
at getUIAttribute (index.js:280)
at Object.avatar (index.js:297)
at eval (core.js:100)
at Object.eval [as render-1] (index.js:31)
at eval (atom.js:54)
at Array.forEach (<anonymous>)
at Atom._change (atom.js:53)
at Atom.swap (atom.js:25)
at swap (index.js:44) For reference, I'm using |
When the component is unmounted, GC will get rid of your internal state, so there's no memory leaks. Yes, we still have to fix this and there's a PR to fix it: #1091 - but this PR touches in a crucial part of the widget and I didn't have time to test all features of lock to make sure everything works. |
Just want to add a +1 to this feature. |
dupe #1090 |
Hey guys,
I see this error when I call
lock.destroy()
:The text was updated successfully, but these errors were encountered: