Skip to content

Commit ec89478

Browse files
committed
🔨 Prevent duplicates output in same multi output callback.
1 parent 9293ad4 commit ec89478

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

dash/dash.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,19 @@ def _validate_callback(self, output, inputs, state):
653653
'Same output and input: {}'.format(bad)
654654
)
655655

656+
if is_multi:
657+
if len(set(output)) != len(output):
658+
raise exceptions.DuplicateCallbackOutput(
659+
'Same output was used in a'
660+
' multi output callback!\n Duplicates:\n {}'.format(
661+
',\n'.join(
662+
k for k, v in
663+
((str(x), output.count(x)) for x in output)
664+
if v > 1
665+
)
666+
)
667+
)
668+
656669
if (layout is None and
657670
not self.config.first('suppress_callback_exceptions',
658671
'supress_callback_exceptions')):
@@ -781,7 +794,7 @@ def _validate_callback(self, output, inputs, state):
781794
if is_multi:
782795
def duplicate_check():
783796
ns['duplicates'] = callbacks.intersection(
784-
_create_callback_id(y) for y in output
797+
str(y) for y in output
785798
)
786799
return ns['duplicates']
787800
else:

0 commit comments

Comments
 (0)