Why doesn't my graph update even though the callback is called?

I have a Dash app in python, with 2 dcc.Graph objects, each of them having their own callback. I’m using the “hoverData” attribute of one graph as Input to the other graph, similar to how it’s done in this tutorial about “update graph on hover”. However, for some reason, this callback only updates the graph on the initial loading of the Dash app. After that, it still runs the callback, but the callback doesn’t update the graph. My callback is given here:

             dash.dependencies.Output('figure-2', 'figure'),
             dash.dependencies.Input(f'min', 'value'),
             dash.dependencies.Input(f'max', 'value'),
             dash.dependencies.Input('figure-1', 'hoverData'),
 def update_graphx(min, max, hover, *args):
            fig = px.line(df, x=x, y=z)
            if hover is None:
                return None
            return fig

When I change “return None” to “return fig”, it shows the graph. But when I keep it like this, it never shows the graph, even though it repeatedly prints “foo” when I hover over graph-1. Why could this be happening?

Hi @user23451

Instaed of using “return None” try using “return no_update”, because the Output is expecting a figure and None is not a figure.

I did this but the problem persists. (Note that I could’ve known that this wouldn’t solve it, because when I changed “return None” to “return fig”, it only updates the figure once in the beginning, not afterwards).