Callback Sometimes works?

I have a callback which sometimes works and sometimes doesn’t, not really sure whats going on, after a page refresh the callback will suddenly not work. I’ve took it into it’s own environment so that I can see if it’s anything else in the app causing the issue, but I still get the inconsistency. Below is the code.

> 
> 
> import pandas as pd
> 
> import sqlite3
> 
> import pathlib
> 
> import dash
> 
> from dash.dependencies import Input, Output, State
> 
> import dash_bootstrap_components as dbc
> 
> import dash_core_components as dcc
> 
> import dash_html_components as html
> 
> import dash_table as dt
> 
> from plotly import tools
> 
> import plotly.graph_objs as go
> 
> import plotly.express as px
> 
> import base64
> 
> import cufflinks as cf
> 
> from SQL import *
> 

> 
> app = dash.Dash(external_stylesheets=[dbc.themes.LUX])
> 

> 
> year = "2020"
> 
> month = "February"
> 
> stypemonth = get_stype_month_data(year, month)
> 
> smpiefig = px.pie(stypemonth.to_dict(), values='Value', names='SaleType')
> 

> 
> app.layout = html.Div(
> 
>     [
> 
>         dbc.Row(dbc.Col(html.P(""))),
> 
>         dbc.Row(dbc.Col(dcc.Dropdown(
> 
>             id='sales-month-dropdown',
> 
>             options=[{'label':'January', 'value':'January'},{'label':'February', 'value':'February'}],
> 
>             value='January'
> 
>         ))),
> 
>         dbc.Row(dbc.Col(dcc.Dropdown(
> 
>             id='sales-year-dropdown',
> 
>             options=[{'label':'2020/21', 'value':'2020'},{'label':'2021/22', 'value':'2021'}],
> 
>             value='2020'
> 
>         ))),
> 
>         dbc.Col(dcc.Graph(figure=smpiefig,id='sales-stypemonthpie')),
> 
>         ]
> 
>     )
> 
 
> 
> @app.callback(
> 
>     Output("sales-stypemonthpie","figure"),
> 
>     [Input("sales-month-dropdown", "value"),
> 
>     Input("sales-year-dropdown", "value")]
> 
> )
> 
> def update_sales_smpie(selected_month, selected_year):
> 
>     newstypemonth = get_stype_month_data(selected_month, selected_year)
> 
>     newsmpiefig = px.pie(newstypemonth.to_dict(), values='Value', names='SaleType')
> 
>     print(selected_month + selected_year)
> 
>     return newsmpiefig 
> 

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

> Blockquote

Any help would be appreciated!

Bump - Can anyone help with this?

What version of Dash are you using?

I’m having a similar problem. I didn’t have an issue before upgrading to Dash 1.11.0 recently.

My problem is as follows. I have a dash_table callback with a single input for ‘is_focused’.

The callback gets called on startup when ‘is_focused’ is ‘None’ - fine. Then the first time I click a dash_table cell, the callback is called, also fine, but thereafter whenever I click on a cell, the callback never gets called again.

What the callback does is simply to set outputs ‘active_cell’ & ‘selected_cells’ to: dict (row = -1, column = -1), so that I can get rid of the pesky cell highlight/active coloring (as the table is not editable in any way and the highlighting is undesired).

My dash is version 1.10.0

I updated to the latest version and am still getting issues

Bump - can anyone offer any help on this?