Component development: render three times

When I was developing a component, for some unknown reason, the component output render three times every time I clicked it.

my src/lib/components/*.react.js:

And my usage.py

import dash_toastify
from dash import Dash, callback, html, Input, Output

app = Dash(__name__)

app.layout = html.Div([
    dash_toastify.DashToastify(
        id='output',
        label = "a",
    ),
    html.Button("show error",id='click')
])


@callback(Output('output', 'label'), Input('click', 'n_clicks'))
def display_output(value):
    print(1)
    return "s"


if __name__ == '__main__':
    app.run_server(debug=True)

When you run in debug mode, the code is run mutiple times. Try setting debug to false.

Hello, I set debug = False and still the same thing.

This happened to me in the past two days, and it didn’t seem to happen before. Do you need me to send all code for you to see? The example is very simple, just change a few lines of code.

I have the same issue and i dont know why this happens

As of march 30 2025 this is still not solved and i am experiencing heavy performance issues on my deckgl component, because rerendering it 3 times instead of 1 is very very expensive. Isnt there any other solution than porting my whole application on React?

Hello @Defe95,

I have a PR for dash 3 that lowers the renders.

1 Like