Hello,
I am facing a serious issue which has stopped my app from running. I am updating a page after user authentication to switch it from the login page to the content one. the content page is generated by a function. below is the relevant code blocks. For some reason I get a vague error saying:
dash.exceptions.InvalidCallbackReturnValue: The callback for property `children` of component `page-content`
returned a value which is not JSON serializable.
In general, Dash properties can only be dash components, strings,
dictionaries, numbers, None, or lists of those.
despite my return type being <class 'dash_html_components.Div.Div'>
Here is my relevant code blocks:
TAB_VIEW = dcc.Tabs(id='TABS_DISPLAY', children=[TAB0,TAB1,TAB2,TAB3,TAB4])
@validate_login_session
def app_display(VIEW_TYPE):
return html.Div([
dcc.Location(id='home-url', pathname='/home'),
html.Div([
html.Div([
html.Button('Tabular View', id='tab-view-button'),
html.Button('Print View', id='report-view-button'),
], style={'display':'inline-block'}),
html.Div([
dcc.Link(html.Button('Restart'), href='/home', style={'display':'inline-block'}),
dbc.Button('Logout',id='logout-button',color='danger',block=True,size='sm', style={'display':'inline-block'}),
], style={'display':'inline-block'}),
], style={'display':'flex', 'justify-content':'space-between'}),
html.Div(id='DISPLAY', children=[VIEW_TYPE])
])
################################################################################################
app.layout = html.Div([
dcc.Location(id='url',refresh=False),
html.Div(
id='page-content',
children=[login_layout()]
),
])
##################################################################################
##################################################################################
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
# [State('CONTENT1', 'children'),
# State('CONTENT2', 'children'),
# State('CONTENT3', 'children')])
def DISPLAY(pathname):
if pathname == '/home':
print(type(app_display(TAB_VIEW)))
return app_display(TAB_VIEW)
# elif pathname == '/report':
# PAGE1 = html.Div(id='PAGE1', children=C1)
# PAGE2 = html.Div(id='PAGE2', children=C2)
# PAGE3 = html.Div(id='PAGE3', children=C3)
# REPORT_VIEW = html.Div([PAGE1,PAGE2,PAGE3])
# return app_display(REPORT_VIEW)
elif pathname == '/login':
return login_layout()
else:
return login_layout()
please help, thanks