No update from @param.depends

Hi, I posted a question to https://discourse.holoviz.org/t/updating-matplotlib-figure-in-parameterized-class/135?u=marfel, but I guess it got overlooked because the topic was closed.

So, once again, referring to the proposed solution: I have a similarly structured app, but without the long calculation. Hence I would like continuous updates. But simply changing

    @param.depends('update')    

into

    @param.depends('max_value')    

doesn’t seem to cut it. Although the Update button still works, no automatic plotting happens if I change the number. What am I missing here?

Hi @marfel,

How about changing

@param.depends("max_value")

into

@param.depends("max_value", watch=True)

I believe that adding watch=True will trigger the callback (the method decorated with @param.depends(...) everytime one of the listed parameters change. If your callback doesn’t return anything (it just does something like self.someparam = new_value), it’s a good hint for you to add watch=True to the decorator.

Let me know if that solves your issue :slight_smile:

2 Likes

Yes indeed, how about it? Thanks a lot, that was the solution! :sweat_smile:

@philippjfr Maybe the fact that watch=True is needed whenever the decorated method does not return anything should be stated directly in the documentation. From the GoogleMapViewer example in https://panel.holoviz.org/user_guide/Param.html I assumed the watch ensured that the change to self.param['country'] triggers the view() method, which depends on country.

1 Like

Yes, this is a recurring source of confusion for users if you can find a way to make the difference much clearer in the docs by submitting a PR that would be hugely appreciated. If you don’t have the bandwidth please just open an issue.