Hey guys,
I see this error when I call lock.destroy():
Uncaught TypeError: Cannot read property 'getIn' of undefined
at http://localhost:3001/assets/vendors.js:16215:15
at getUIAttribute (http://localhost:3001/assets/vendors.js:7967:10)
at Object.avatar (http://localhost:3001/assets/vendors.js:7984:12)
at http://localhost:3001/assets/vendors.js:6961:25
at Object.render-1 (http://localhost:3001/assets/vendors.js:12553:20)
at http://localhost:3001/assets/vendors.js:15998:24
at Array.forEach (native)
at Atom._change (http://localhost:3001/assets/vendors.js:15997:26)
at Atom.swap (http://localhost:3001/assets/vendors.js:15969:17)
at swap (http://localhost:3001/assets/vendors.js:12566:21)
at removeLock (http://localhost:3001/assets/vendors.js:7289:19)
at Auth0Lock.destroy (http://localhost:3001/assets/vendors.js:7061:29)
at Auth0Lock.<anonymous> (http://localhost:3001/assets/client.js:35:12)
at Auth0Lock../node_modules/events/events.js.EventEmitter.emit (http://localhost:3001/assets/vendors.js:31155:17)
at http://localhost:3001/assets/vendors.js:8337:35
@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 lock.destroy() will be tackled any time soon?
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 [email protected]. Let me know if there is any additional info that I can provide to help!
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: https://github.com/auth0/lock/pull/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