fix: Add missing unwatch() method to Callback class - #8453
Merged
philippjfr merged 2 commits intoMar 2, 2026
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8453 +/- ##
==========================================
- Coverage 86.12% 86.01% -0.11%
==========================================
Files 349 349
Lines 54971 54996 +25
==========================================
- Hits 47343 47307 -36
- Misses 7628 7689 +61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
philippjfr
approved these changes
Mar 2, 2026
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What's the issue?
While I picked up the issue #7440, the docs for
js_on_clicksay the returnedCallback"can be used to disable the callback", so I went ahead and verified that in the docs, then tested it myself:Confirmed, so the issue persists. The docs doesn't match with the code's output itself.
Root Cause
I went into
panel/links.pywhere theCallbackclass lives. Here's what I found:Callbackis created viajs_on_click, it registers itself into aWeakKeyDictionarycalledregistry— keyed by the source widget._process_callbackslater walks through this registry to attach the JS callbacks to the Bokeh model on render.Link(which extendsCallback) already had anunlink()method that simply removes itself from the registry.Callbackclass? Nothing. Nounwatch(), nounregister(), no way to undo it at all.Fix
Added
unwatch()to theCallbackclass, mirroringLink.unlink():Notes
Link.unlink()behaviour.Closes #7440.
AI Disclosure: I used Gemini 3 Flash to explore and understand the codebase while working on this fix.