@@ -989,6 +989,11 @@ def callback(self, *args, **kwargs):
989
989
not to fire when its outputs are first added to the page. Defaults to
990
990
`False` unless `prevent_initial_callbacks=True` at the app level.
991
991
"""
992
+ # for backward compatibility, store whether first argument is a
993
+ # list of only 1 Output
994
+ specified_output_list = (
995
+ isinstance (args [0 ], (list , tuple ))
996
+ and len (args [0 ]) == 1 )
992
997
output , inputs , state , callback_args , prevent_initial_call = _handle_callback_args (args , kwargs )
993
998
callback_id = self ._insert_callback (output , inputs , state , callback_args , prevent_initial_call )
994
999
@@ -1005,11 +1010,8 @@ def add_context(*args, **kwargs):
1005
1010
1006
1011
# wrap single outputs so we can treat them all the same
1007
1012
# for validation and response creation
1008
- if not isinstance (output_value , (list , tuple )):
1009
- if not isinstance (output_spec , (list , tuple )):
1010
- output_value , output_spec = [output_value ], [output_spec ]
1011
- else :
1012
- output_value , output_spec = [output_value ], output_spec
1013
+ if len (output_spec ) == 1 and not specified_output_list :
1014
+ output_value = [output_value ]
1013
1015
1014
1016
_validate .validate_multi_return (output_spec , output_value , callback_id )
1015
1017
0 commit comments