@@ -626,9 +626,10 @@ export function validateCallbacksToLayout(state_, dispatchError) {
626626 validatePatterns ( inputPatterns , 'Input' ) ;
627627}
628628
629- export function computeGraphs ( dependencies , dispatchError ) {
629+ export function computeGraphs ( dependencies , dispatchError , config ) {
630630 // multiGraph is just for finding circular deps
631631 const multiGraph = new DepGraph ( ) ;
632+ const start = performance . now ( ) ;
632633
633634 const wildcardPlaceholders = { } ;
634635
@@ -657,7 +658,9 @@ export function computeGraphs(dependencies, dispatchError) {
657658 hasError = true ;
658659 dispatchError ( message , lines ) ;
659660 } ;
660- validateDependencies ( parsedDependencies , wrappedDE ) ;
661+ if ( config . validate_callbacks ) {
662+ validateDependencies ( parsedDependencies , wrappedDE ) ;
663+ }
661664
662665 /*
663666 * For regular ids, outputMap and inputMap are:
@@ -808,6 +811,7 @@ export function computeGraphs(dependencies, dispatchError) {
808811 const cbOut = [ ] ;
809812
810813 function addInputToMulti ( inIdProp , outIdProp , firstPass = true ) {
814+ if ( ! config . validate_callbacks ) return
811815 multiGraph . addNode ( inIdProp ) ;
812816 multiGraph . addDependency ( inIdProp , outIdProp ) ;
813817 // only store callback inputs and outputs during the first pass
@@ -825,6 +829,7 @@ export function computeGraphs(dependencies, dispatchError) {
825829 cbOut . push ( [ ] ) ;
826830
827831 function addOutputToMulti ( outIdFinal , outIdProp ) {
832+ if ( ! config . validate_callbacks ) return
828833 multiGraph . addNode ( outIdProp ) ;
829834 inputs . forEach ( inObj => {
830835 const { id : inId , property} = inObj ;
@@ -859,28 +864,35 @@ export function computeGraphs(dependencies, dispatchError) {
859864 outputs . forEach ( outIdProp => {
860865 const { id : outId , property} = outIdProp ;
861866 // check if this output is also an input to the same callback
862- const alsoInput = checkInOutOverlap ( outIdProp , inputs ) ;
867+ let alsoInput ;
868+ if ( config . validate_callbacks ) {
869+ alsoInput = checkInOutOverlap ( outIdProp , inputs ) ;
870+ }
863871 if ( typeof outId === 'object' ) {
864- const outIdList = makeAllIds ( outId , { } ) ;
865- outIdList . forEach ( id => {
866- const tempOutIdProp = { id, property} ;
867- let outIdName = combineIdAndProp ( tempOutIdProp ) ;
872+ if ( config . validate_callbacks ) {
873+ const outIdList = makeAllIds ( outId , { } ) ;
874+ outIdList . forEach ( id => {
875+ const tempOutIdProp = { id, property} ;
876+ let outIdName = combineIdAndProp ( tempOutIdProp ) ;
877+ // if this output is also an input, add `outputTag` to the name
878+ if ( alsoInput ) {
879+ duplicateOutputs . push ( tempOutIdProp ) ;
880+ outIdName += outputTag ;
881+ }
882+ addOutputToMulti ( id , outIdName ) ;
883+ } ) ;
884+ }
885+ addPattern ( outputPatterns , outId , property , finalDependency ) ;
886+ } else {
887+ if ( config . validate_callbacks ) {
888+ let outIdName = combineIdAndProp ( outIdProp ) ;
868889 // if this output is also an input, add `outputTag` to the name
869890 if ( alsoInput ) {
870- duplicateOutputs . push ( tempOutIdProp ) ;
891+ duplicateOutputs . push ( outIdProp ) ;
871892 outIdName += outputTag ;
872893 }
873- addOutputToMulti ( id , outIdName ) ;
874- } ) ;
875- addPattern ( outputPatterns , outId , property , finalDependency ) ;
876- } else {
877- let outIdName = combineIdAndProp ( outIdProp ) ;
878- // if this output is also an input, add `outputTag` to the name
879- if ( alsoInput ) {
880- duplicateOutputs . push ( outIdProp ) ;
881- outIdName += outputTag ;
894+ addOutputToMulti ( { } , outIdName ) ;
882895 }
883- addOutputToMulti ( { } , outIdName ) ;
884896 addMap ( outputMap , outId , property , finalDependency ) ;
885897 }
886898 } ) ;
@@ -913,7 +925,8 @@ export function computeGraphs(dependencies, dispatchError) {
913925 }
914926 }
915927 } ) ;
916-
928+ const end = performance . now ( ) ;
929+ window . dash_clientside . callbackGraphTime = ( end - start ) . toFixed ( 2 ) ;
917930 return finalGraphs ;
918931}
919932
0 commit comments