Skip to content

fix: function 'unregister', someplace maybe inaccurate #1426

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

Closed
wants to merge 2 commits into from

Conversation

zwwill
Copy link

@zwwill zwwill commented Oct 17, 2018

Function parent.getChild(key) could return undefined

Function `parent.getChild(key)` could return `undefined`
Update module-collection.js
@@ -49,7 +49,7 @@ export default class ModuleCollection {
unregister (path) {
const parent = this.get(path.slice(0, -1))
const key = path[path.length - 1]
if (!parent.getChild(key).runtime) return
if (!parent.getChild(key) || !parent.getChild(key).runtime) return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer assertion rather than silently ignoring when the specified module does not exist. Can we change the implementation to that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, maybe you can do it better latter

@kiaking
Copy link
Member

kiaking commented Apr 20, 2020

@zwwill Sorry for mentioning in old PR, though do you think it would be possible to include the suggestion from @ktsn to this PR?

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

Successfully merging this pull request may close these issues.

3 participants