(outputs, head, dispatchError, outStrs, outObjs)
| 355 | } |
| 356 | |
| 357 | function findDuplicateOutputs(outputs, head, dispatchError, outStrs, outObjs) { |
| 358 | const newOutputStrs = {}; |
| 359 | const newOutputObjs = []; |
| 360 | outputs.forEach(({id, property}, i) => { |
| 361 | if (typeof id === 'string') { |
| 362 | const idProp = combineIdAndProp({id, property}); |
| 363 | if (newOutputStrs[idProp]) { |
| 364 | dispatchError('Duplicate callback Outputs', [ |
| 365 | head, |
| 366 | `Output ${i} (${idProp}) is already used by this callback.` |
| 367 | ]); |
| 368 | } else if (outStrs[idProp]) { |
| 369 | dispatchError('Duplicate callback outputs', [ |
| 370 | head, |
| 371 | `Output ${i} (${idProp}) is already in use.`, |
| 372 | 'To resolve this, set `allow_duplicate=True` on', |
| 373 | 'duplicate outputs, or combine the outputs into', |
| 374 | 'one callback function, distinguishing the trigger', |
| 375 | 'by using `dash.callback_context` if necessary.' |
| 376 | ]); |
| 377 | } else { |
| 378 | newOutputStrs[idProp] = 1; |
| 379 | } |
| 380 | } else { |
| 381 | const idObj = {id, property}; |
| 382 | const selfOverlap = wildcardOverlap(idObj, newOutputObjs); |
| 383 | const otherOverlap = selfOverlap || wildcardOverlap(idObj, outObjs); |
| 384 | if (selfOverlap || otherOverlap) { |
| 385 | const idProp = combineIdAndProp(idObj); |
| 386 | const idProp2 = combineIdAndProp(selfOverlap || otherOverlap); |
| 387 | dispatchError('Overlapping wildcard callback outputs', [ |
| 388 | head, |
| 389 | `Output ${i} (${idProp})`, |
| 390 | `overlaps another output (${idProp2})`, |
| 391 | `used in ${selfOverlap ? 'this' : 'a different'} callback.` |
| 392 | ]); |
| 393 | } else { |
| 394 | newOutputObjs.push(idObj); |
| 395 | } |
| 396 | } |
| 397 | }); |
| 398 | keys(newOutputStrs).forEach(k => { |
| 399 | outStrs[k] = 1; |
| 400 | }); |
| 401 | newOutputObjs.forEach(idObj => { |
| 402 | outObjs.push(idObj); |
| 403 | }); |
| 404 | } |
| 405 | |
| 406 | function checkInOutOverlap(out, inputs) { |
| 407 | const {id: outId, property: outProp} = out; |
no test coverage detected
searching dependent graphs…