You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of expected behavior and the observed behavior
I'm trying to use @pm.depends(pn.state.param.busy, watch=True) on an instance method of a class. When I modify a parameter, I expect the method to get called once with argument busy=True and once with argument busy=False.
Instead I'm seeing potentially 2 issues:
Whenever I use @pm.depends(pn.state.param.busy, watch=True), even on a normal function, the function or method gets called 4 times, with arguments busy = True/False/True/False. It doesn't seem to be due to the watch argument because when I remove it nothing gets called.
In case of a method, every call gets duplicated (for a total of 8) and in half the calls the self argument is the boolean busy, in the other half it's the expected object instance. I never get both in the same call.
See example code and output below.
Complete, minimal, self-contained example code that reproduces the issue
I'm using workaround #1 in my real application and somehow it's only calling the indicator twice (busy = True, False). Not really sure what the difference is, I have 2 methods that each depend on the same 4 parameters defined on the class. Good news though 🙂
So effectively the debug method is called twice, the second call being weird as it's calling debug as if it was a simple function passing True to self.
ALL software version info
Description of expected behavior and the observed behavior
I'm trying to use
@pm.depends(pn.state.param.busy, watch=True)
on an instance method of a class. When I modify a parameter, I expect the method to get called once with argumentbusy=True
and once with argumentbusy=False
.Instead I'm seeing potentially 2 issues:
@pm.depends(pn.state.param.busy, watch=True)
, even on a normal function, the function or method gets called 4 times, with arguments busy = True/False/True/False. It doesn't seem to be due to thewatch
argument because when I remove it nothing gets called.self
argument is the booleanbusy
, in the other half it's the expected object instance. I never get both in the same call.See example code and output below.
Complete, minimal, self-contained example code that reproduces the issue
Output when changing value
Example as-is:
When commenting out the method and uncommenting the function:
Workaround for method vs function
Below two potential workarounds. The method still gets called 4 times though.
Output (workaround 1):
Output (workaround 2):
The text was updated successfully, but these errors were encountered: