Skip to content

fix: preserve existing namespaces on enable() call - #1055

Open
yunaremaia wants to merge 1 commit into
debug-js:masterfrom
yunaremaia:fix/enable-merge-namespaces
Open

fix: preserve existing namespaces on enable() call#1055
yunaremaia wants to merge 1 commit into
debug-js:masterfrom
yunaremaia:fix/enable-merge-namespaces

Conversation

@yunaremaia

Copy link
Copy Markdown

Previously, calling enable() would reset the names and skips arrays, clearing any namespaces that were previously enabled.

This caused behavior where debug.enable('bar') after DEBUG=foo would silently disable the foo namespace, surprising users who expected both to be active.

The fix makes enable() merge namespaces instead of replacing them. Empty/null/undefined still resets (for disable() compatibility).

Fixes #425

Previously, calling `enable()` would reset the `names` and `skips`
arrays, clearing any namespaces that were previously enabled.

This caused behavior where `debug.enable('bar')` after `DEBUG=foo`
would silently disable the 'foo' namespace, surprising users who
expected both to be active.

The fix makes `enable()` merge namespaces instead of replacing
them. Empty/null/undefined still resets (for `disable()` compatibility).

Fixes debug-js#425
@yunaremaia

Copy link
Copy Markdown
Author

CI hasn't been triggered yet on this PR. Could you re-run the workflow or let me know if there's anything I need to do to trigger CI checks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

debug.enable() flushes enabled namespaces

1 participant