Skip to content

Honor queued and precedence options for reactive watchers - #1214

Open
Shubham-Padkonde wants to merge 2 commits into
holoviz:mainfrom
Shubham-Padkonde:fix/reactive-watch-ordering
Open

Shubham-Padkonde wants to merge 2 commits into
holoviz:mainfrom
Shubham-Padkonde:fix/reactive-watch-ordering

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

The reproduction for #996 demonstrates the remaining problem with queued and precedence: callbacks execute in registration order, and a nested update runs recursively even with queued=True. This addresses the existing report; no production HoloViz application is claimed.

import param

source = param.rx(0)
calls = []
source.rx.watch(lambda v: calls.append("late"), precedence=2)
source.rx.watch(lambda v: calls.append("early"), precedence=1)
source.rx.value = 1
print(calls)
# Before: ['late', 'early']
# After:  ['early', 'late']

One detail needs attention: the internal updating-status callback must run after dependency invalidation/ref syncing. Giving it the previously ignored priority of -999 causes it to evaluate stale inputs; priority 0 preserves the existing async status tests.

Validation: 1,737 tests passed, 111 skipped (optional dependencies), 2 expected failures, and 8 subtests passed. Ruff and whitespace checks pass. The two new failing cases were reproduced before the fix.

References: #996; watcher ordering documentation.

Prepared with OpenAI Codex assistance.

Before and after watcher ordering reproduction

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.66%. Comparing base (563a429) to head (7a4c4b6).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1214      +/-   ##
==========================================
+ Coverage   89.65%   89.66%   +0.01%     
==========================================
  Files          10       10              
  Lines        6870     6878       +8     
==========================================
+ Hits         6159     6167       +8     
  Misses        711      711              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

2 participants