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

fix: warn when unregistering non existing module #1786

Merged
merged 2 commits into from Jun 29, 2020

Conversation

kiaking
Copy link
Member

@kiaking kiaking commented Jun 29, 2020

close #1426

This PR adds warning when removing non existing module. Currently, it fails due to runtime not exist in undefined error. It's follow up PR for #1426.

It will only warn in development mode, so it will not introduce any braking changes.

@kiaking kiaking requested a review from ktsn June 29, 2020 14:28
@kiaking kiaking self-assigned this Jun 29, 2020
@@ -49,7 +49,20 @@ 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)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we store the return value of getChild in a variable so that we reuse it with the next if condition?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yeah good point! Thanks. I've done it, and rebased (to the latest dev) and pushed 👍

@kiaking kiaking force-pushed the warn-when-unregistering-non-existing-module branch from 626b1de to 4fae622 Compare June 29, 2020 14:45
Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ktsn ktsn merged commit 7cec79d into dev Jun 29, 2020
@ktsn ktsn deleted the warn-when-unregistering-non-existing-module branch June 29, 2020 14:53
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.

None yet

2 participants