Skip to content

Commit 08ddc9c

Browse files
committed
Fix backward compatibility for single output lists
1 parent e7b9d5e commit 08ddc9c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: dash/dash.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,11 @@ def clientside_callback(self, clientside_function, *args):
915915
}
916916

917917
def callback(self, *args):
918+
# for backward compatibility, store whether first argument is a
919+
# list of only 1 Output
920+
specified_output_list = (
921+
isinstance(args[0], (list, tuple))
922+
and len(args[0]) == 1)
918923
output, inputs, state, callback_args = _handle_callback_args(*args)
919924
callback_id = self._insert_callback(output, inputs, state, callback_args)
920925

@@ -931,11 +936,8 @@ def add_context(*args, **kwargs):
931936

932937
# wrap single outputs so we can treat them all the same
933938
# for validation and response creation
934-
if not isinstance(output_value, (list, tuple)):
935-
if not isinstance(output_spec, (list, tuple)):
936-
output_value, output_spec = [output_value], [output_spec]
937-
else:
938-
output_value, output_spec = [output_value], output_spec
939+
if len(output_spec) == 1 and not specified_output_list:
940+
output_value = [output_value]
939941

940942
_validate.validate_multi_return(output_spec, output_value, callback_id)
941943

0 commit comments

Comments
 (0)