Reactive: root executed while updating a branch
maximlt opened this issue · 1 comments
maximlt commented
I was trying to understand what happens when a reactive expressions has multiple "reactive inputs".
graph TD;
firstnamex-->append_lastname;
lastnamex-->append_lastname;
Looking at the last cell of the image below, I'm surprised to see 'transforming first name johnny'
being printed while updating lastnamex
, is that expected?
from param import rx
firstnamex = rx('john')
lastnamex = rx('lenon')
def debug(value, info=''):
print(info, value)
return value
def append_lastname(fn, ln):
return fn + ' ' + ln
pfnx = firstnamex.rx.pipe(debug, info='transforming first name').title()
plnx = lastnamex.rx.pipe(debug, info='transforming last name').title()
together = pfnx.rx.pipe(append_lastname, ln=plnx).rx.pipe(debug, info='merged')
together
firstnamex.rx.value = 'johnny'
lastnamex.rx.value = 'hallyday'