Dash App frozen on Updating

Hello can somebody help me understand why my App keeps being frozen on Loading. I have an Example provided:

from dash.exceptions import PreventUpdate
from dash import html, dcc, Input, Output, callback, Dash, State
import dash_bootstrap_components as dbc
import dash
import dash_ag_grid as dag
import dash_mantine_components as dmc
import pandas as pd



app = Dash(__name__, external_stylesheets=[dbc.themes.CYBORG, dbc.icons.FONT_AWESOME, dbc.icons.BOOTSTRAP])



StockSearchInput = dbc.Input(id="SearchStockInput", placeholder="Enter Stock please", type='text', minLength="800", debounce=True)
SearchStockButton = dbc.Button("Search",id ="SearchBtn",size="sm",outline="True", color="primary",style={"width":"80px", "marginLeft": "5px"},className="me-2"),

data = {'SYMBOL': ['GOOG', 'MSFT', 'META', 'NFLX', 'AAPL',"TSLA","AMZN","GME","AMD","PYPL"]
,
        'NAME': ["Alphabet Inc.", "Microsoft Corporation", "Meta Platforms Inc.", "Netflix Inc.", "Apple Inc.", "TSLA.Inc", "Amazon.com Inc.", "GameStop", "Advanced Micro Devices Inc.", "PayPal"],
        }


DefaultSearchTableDf = pd.DataFrame(data)
DefaultSearchTableDf['REGION']="United States"
DefaultSearchTableDf['CURRENCY']="USD"
DefaultSearchTableDf['GRAPH']=""


columnDefs =[

    {"headerName":"Stock Ticker",
     "field": "SYMBOL",
     "sortable": True, 
     "filter": True,
     },
 
    {"headerName": "TTM",
     "field":"GRAPH", 
    },

    {"headerName":"Company Name",
     "field": "NAME",
     "sortable": True, 
     "filter": True,
      'cellStyle':{
      "display": "flex",
      "vertical-align": "middle",
      "align-items": "center"}
      },

    {"headerName": "Region",
      "field": "REGION",
      "sortable": True, 
      "filter": True,
      'cellStyle':{
      "display": "flex",
      "vertical-align": "middle",
      "align-items": "center"}},

    {"headerName": "Currency",
     "field": "CURRENCY",
     'cellStyle':{
     "display": "flex",
      "vertical-align": "middle",
      "align-items": "center"}
     }

]
defaultColDef = {
    "resizable": True,
    "sortable": False,
    "editable": False,
}
grid= dag.AgGrid(
            id="selection-single-grid",
            columnDefs=columnDefs,
            className="ag-theme-alpine-dark color-fonts",
            rowData=DefaultSearchTableDf.to_dict('records'),
            columnSize="sizeToFit",
            defaultColDef=defaultColDef,
            dashGridOptions={"rowSelection": "single",
                             "rowHeight": 60,
                            "domLayout":'autoHeight'}
            
        ),


layout = dbc.Container(
                 html.Div
                    (
                 [
       
                 dbc.Row([
                     dbc.Col(StockSearchInput, width={"size": 6 , "offset": 1}),
                     dbc.Col(SearchStockButton, width={"size": 2})
                     ]),   
                 html.Br(),  
                 dbc.Row([
                     dbc.Col(grid, width={"size": 9 , "offset": 1})]),
                 
				 #Stores for Searchscreen
				 dcc.Store(id="SearchResults",storage_type='memory'),
		         dcc.Location(id='location'),
                    ]), fluid=True
                 )




if __name__ == '__main__':
	app.run_server(debug=True, port=8051)
1 Like

Hi @cosco. I don’t understand meaning of being frozen on Loading. Are you meaning that your app not run?

Hello hoatran, sry I do not see any error messages justa black screen in my browser :frowning:
Best Regards
Clemens

Can you try to use app.layout instead of layout?

2 Likes

Yes thank you now its working fine, but my problem lies somewhere else then :slight_smile: Maybe I will come back to you. Thank you for the fast help!

So I had written “prevent_inital_call=True” in one of my Callbacks and I didnt have any error message appearing, I corrected it to “prevent_initial_call=True” and now it works fine again :slight_smile: Nvm thanks