MCPcopy Index your code
hub / github.com/plotly/dash / unwrapIfNotMulti

Function unwrapIfNotMulti

dash/dash-renderer/src/actions/callbacks.ts:116–166  ·  view source on GitHub ↗
(
    paths: any,
    idProps: any,
    spec: any,
    anyVals: any,
    depType: any
)

Source from the content-addressed store, hash-verified

114const setCallbackJobOutdated = createAction('CALLBACK_JOB_OUTDATED');
115
116function unwrapIfNotMulti(
117 paths: any,
118 idProps: any,
119 spec: any,
120 anyVals: any,
121 depType: any
122) {
123 let msg = '';
124
125 if (isMultiValued(spec)) {
126 return [idProps, msg];
127 }
128
129 if (idProps.length !== 1) {
130 if (!idProps.length) {
131 if (spec.allow_optional) {
132 idProps = [{...spec, value: null}];
133 msg = '';
134 } else {
135 const isStr = typeof spec.id === 'string';
136 msg =
137 'A nonexistent object was used in an `' +
138 depType +
139 '` of a Dash callback. The id of this object is ' +
140 (isStr
141 ? '`' + spec.id + '`'
142 : JSON.stringify(spec.id) +
143 (anyVals ? ' with MATCH values ' + anyVals : '')) +
144 ' and the property is `' +
145 spec.property +
146 (isStr
147 ? '`. The string ids in the current layout are: [' +
148 keys(paths.strs).join(', ') +
149 ']'
150 : '`. The wildcard ids currently available are logged above.');
151 }
152 } else {
153 msg =
154 'Multiple objects were found for an `' +
155 depType +
156 '` of a callback that only takes one value. The id spec is ' +
157 JSON.stringify(spec.id) +
158 (anyVals ? ' with MATCH values ' + anyVals : '') +
159 ' and the property is `' +
160 spec.property +
161 '`. The objects we found are: ' +
162 JSON.stringify(map(pick(['id', 'property']), idProps));
163 }
164 }
165 return [idProps[0], msg];
166}
167
168function fillVals(
169 paths: any,

Callers 2

fillValsFunction · 0.85
executeCallbackFunction · 0.85

Calls 1

isMultiValuedFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…