fix: widget.link() to support HoloViews streams - #8450
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8450 +/- ##
==========================================
- Coverage 86.12% 86.03% -0.09%
==========================================
Files 349 349
Lines 54971 54986 +15
==========================================
- Hits 47343 47308 -35
- Misses 7628 7678 +50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
widget.link() to support HoloViews streamswidget.link() to support HoloViews streams
widget.link() to support HoloViews streamswidget.link() to support HoloViews streams
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.
Problem
Panel's
widget.link()method is designed to create bidirectional connections between widgets and other parameterized objects. When we try to link a widget to a HoloViews stream (used for interactive plots), the connection appears to be made, but it doesn't actually work.For example, when we write:
We expect that clicking a row in the table will update the plot selection, and clicking a point in the plot will update the table selection. However, while the table selection changes correctly, the plot never updates because the stream's subscribers aren't notified.
The video demonstrates:
Before fix: Using a single tabulator.link() call doesn't work
PR3_Before.mp4
After fix: Using a single
tabulator.link()call that works correctlyPR3_After.mp4
What's happening: The
link()method usessetattr()to update the stream parameter. This sets the value correctly, but HoloViews streams need their.event()method to be called to notify all subscribers (likeDynamicMapobjects) that something changed. Without calling.event(), the stream value changes silently but nothing listening to the stream gets notified, so plots don't refresh.The workaround required two separate
pn.bind()calls:Solution
Modified
Reactive.link()inpanel/reactive.pyto detect when the link target is a HoloViewsStreamobject. When detected, it calls.event()instead ofsetattr(), which properly triggers all stream subscribers and enablesDynamicMapupdates.The fix is fully backward compatible — it only changes behavior for HoloViews stream targets. All other
.link()calls work exactly as before.Example
Before — required two
pn.bind()calls:After — one simple
.link()call:Files Changed
panel/reactive.py— UpdatedReactive.link()to call.event()on HoloViews stream targetsRelated Issue
Closes #7801