File tree Expand file tree Collapse file tree 3 files changed +38
-6
lines changed
tests/integration/callbacks Expand file tree Collapse file tree 3 files changed +38
-6
lines changed Original file line number Diff line number Diff line change @@ -302,12 +302,19 @@ const observer: IStoreObserverDefinition<IStoreState> = {
302302 }
303303
304304 if ( error !== undefined ) {
305- const outputs = payload
306- ? map ( combineIdAndProp , flatten ( [ payload . outputs ] ) ) . join (
307- ', '
308- )
309- : output ;
310- let message = `Callback error updating ${ outputs } ` ;
305+ let message ;
306+ if ( cb . callback . no_output ) {
307+ const inpts = keys ( cb . changedPropIds ) . join ( ', ' ) ;
308+ message = `Callback error with no output from input ${ inpts } ` ;
309+ } else {
310+ const outputs = payload
311+ ? map (
312+ combineIdAndProp ,
313+ flatten ( [ payload . outputs ] )
314+ ) . join ( ', ' )
315+ : output ;
316+ message = `Callback error updating ${ outputs } ` ;
317+ }
311318 if ( clientside_function ) {
312319 const { namespace : ns , function_name : fn } =
313320 clientside_function ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export interface ICallbackDefinition {
1414 long ?: LongCallbackInfo ;
1515 dynamic_creator ?: boolean ;
1616 running : any ;
17+ no_output ?: boolean ;
1718}
1819
1920export interface ICallbackProperty {
Original file line number Diff line number Diff line change @@ -141,3 +141,27 @@ def on_click(n_clicks):
141141
142142 dash_duo .wait_for_element ("#click" ).click ()
143143 dash_duo .wait_for_text_to_equal ("#output" , "Clicked 1 times" )
144+
145+
146+ def test_arb005_no_output_error (dash_duo ):
147+ app = Dash ()
148+
149+ app .layout = html .Div ([html .Button ("start" , id = "start" )])
150+
151+ @app .callback (Input ("start" , "n_clicks" ), prevent_initial_call = True )
152+ def on_click (clicked ):
153+ return f"clicked { clicked } "
154+
155+ dash_duo .start_server (
156+ app ,
157+ debug = True ,
158+ use_reloader = False ,
159+ use_debugger = True ,
160+ dev_tools_hot_reload = False ,
161+ )
162+
163+ dash_duo .wait_for_element ("#start" ).click ()
164+ dash_duo .wait_for_text_to_equal (
165+ ".dash-fe-error__title" ,
166+ "Callback error with no output from input start.n_clicks" ,
167+ )
You can’t perform that action at this time.
0 commit comments