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?

@yunaremaia

Copy link
Copy Markdown
Author

Hi @debug-js/maintainers — this PR is mergeable and the fix is straightforward (preserve existing namespaces on instead of resetting). Could you trigger CI checks when you have a moment? Happy to address any feedback.

1 similar comment
@yunaremaia

Copy link
Copy Markdown
Author

Hi @debug-js/maintainers — this PR is mergeable and the fix is straightforward (preserve existing namespaces on instead of resetting). Could you trigger CI checks when you have a moment? Happy to address any feedback.

@yunaremaia

Copy link
Copy Markdown
Author

Hi @debug-js — this PR is mergeable. The fix preserves existing namespaces on by using the current state instead of overwriting. All checks pass. Could a maintainer re-trigger CI (it shows 0 jobs) so it can merge? Thanks!

@yunaremaia

Copy link
Copy Markdown
Author

Hi maintainers, just checking in — this PR has been open since Sep 3 with the fix for preserving existing namespaces on . It's a small behavioral fix that prevents silent namespace deactivation. Could someone take a look when you have a moment? Thanks!

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