Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursively resolve references on args and kwargs passed to an reactive operation #944

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Jun 13, 2024

Attempts to fix #940

Which can be reproduced with:

import param

start = param.rx(1)
end = param.rx(10)
l = list(range(20))
lrx = param.rx(l)
sx = lrx[start:end]
print(sx.rx.value)  # required to reproduce
start.rx.value = 4
print(sx.rx.value)  # [1, 2, ...], not [4, 5, ...] ! 

I think that the reactive expressions of the start:end slice passed to __getitem__ were not resolved, which means that no watcher was set to invalidate the expression when start is updated. Resolving references recursively fixed the issue and broke no other test, but well, it might be a big hammer 馃 Anyhow, I've also added another similar test that would have failed without this change, this time with a tuple containing reactive expressions passed to Numpy's __getitem__.

@maximlt maximlt requested a review from philippjfr June 13, 2024 16:58
Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is probably a regression introduced when the recursive argument was added to resolve_ref and then set to False by default.

Please also look at resolve_ref and make sure that recursive is passed down recursively.

@philippjfr philippjfr merged commit 35a4729 into main Jun 18, 2024
10 checks passed
@philippjfr philippjfr deleted the fix_reactive_list_slice branch June 18, 2024 13:25
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.

RX: output not updated when indexing a DataFrame with value_start/value_end
2 participants