Skip to content

Keep a module in the runtime when another module uses it - #6017

Merged
knolleary merged 1 commit into
node-red:mainfrom
cestercian:fix-removemodule-usedby
Nov 11, 2026
Merged

knolleary merged 1 commit into
node-red:mainfrom
cestercian:fix-removemodule-usedby

Conversation

@cestercian

Copy link
Copy Markdown
Contributor

removeModule had module.usedBy > 0, but usedBy is 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 as getNodeList and getAllNodeConfigs already 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 empty usedBy still removes normally.

Fixes #6010

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
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: cestercian / name: Cestercian (912437f)

@knolleary
knolleary merged commit cb8c2f3 into node-red:main Nov 11, 2026
3 checks passed
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.

removeModule(): module.usedBy > 0 guard never fires (array compared with number) — removing a module another module depends on fully unregisters it

2 participants