fix: warn when unregistering non existing module #1786
Merged
Conversation
src/module/module-collection.js
Outdated
@@ -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)) { |
ktsn
Jun 29, 2020
Member
Can we store the return value of getChild
in a variable so that we reuse it with the next if condition?
Can we store the return value of getChild
in a variable so that we reuse it with the next if condition?
kiaking
Jun 29, 2020
Author
Member
Oh yeah good point! Thanks. I've done it, and rebased (to the latest dev) and pushed 👍
Oh yeah good point! Thanks. I've done it, and rebased (to the latest dev) and pushed
626b1de
to
4fae622
LGTM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
close #1426
This PR adds warning when removing non existing module. Currently, it fails due to
runtime
not exist inundefined
error. It's follow up PR for #1426.It will only warn in development mode, so it will not introduce any braking changes.