Repository navigation
Keep a module in the runtime when another module uses it - #6017
Merged
Merged
Conversation
removeModule compared the usedBy array with a number, so the check was always false and a module that another module depends on got fully unregistered. Check usedBy.length instead, like getNodeList and getAllNodeConfigs already do. Fixes node-red#6010
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
removeModulehadmodule.usedBy > 0, butusedByis an array of module names, so that check was always false. Removing a module that another module depends on went down the full removal path and unregistered it, leaving the other module broken.Switched it to
usedBy.length > 0, same asgetNodeListandgetAllNodeConfigsalready do. The module now stays registered in the runtime and just gets hidden from the palette, which is what the comment in that branch says should happen.Added two tests in
registry_spec.js: one for a module with a dependent (fails before the fix), and one checking an emptyusedBystill removes normally.Fixes #6010