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

Function fillVals

dash/dash-renderer/src/actions/callbacks.ts:168–218  ·  view source on GitHub ↗
(
    paths: any,
    layout: any,
    cb: ICallback,
    specs: any,
    depType: any,
    allowAllMissing = false
)

Source from the content-addressed store, hash-verified

166}
167
168function fillVals(
169 paths: any,
170 layout: any,
171 cb: ICallback,
172 specs: any,
173 depType: any,
174 allowAllMissing = false
175) {
176 const getter = depType === 'Input' ? cb.getInputs : cb.getState;
177 const errors: any[] = [];
178 let emptyMultiValues = 0;
179
180 const inputVals = getter(paths).map((inputList: any, i: number) => {
181 const [inputs, inputError] = unwrapIfNotMulti(
182 paths,
183 inputList.map(({id, property, path: path_}: any) => ({
184 id,
185 property,
186 value: path([...path_, 'props', property], layout) as any
187 })),
188 specs[i],
189 cb.anyVals,
190 depType
191 );
192 if (isMultiValued(specs[i]) && !inputs.length) {
193 emptyMultiValues++;
194 }
195 if (inputError) {
196 errors.push(inputError);
197 }
198 return inputs;
199 });
200
201 if (errors.length) {
202 if (
203 allowAllMissing &&
204 errors.length + emptyMultiValues === inputVals.length
205 ) {
206 // We have at least one non-multivalued input, but all simple and
207 // multi-valued inputs are missing.
208 // (if all inputs are multivalued and all missing we still return
209 // them as normal, and fire the callback.)
210 return null;
211 }
212 // If we get here we have some missing and some present inputs.
213 // Or all missing in a context that doesn't allow this.
214 // That's a real problem, so throw the first message as an error.
215 refErr(errors, paths);
216 }
217 return inputVals;
218}
219
220function refErr(errors: any, paths: any) {
221 const err = errors[0];

Callers 2

executeCallbackFunction · 0.85
__executeFunction · 0.85

Calls 5

isMultiValuedFunction · 0.90
unwrapIfNotMultiFunction · 0.85
refErrFunction · 0.85
pushMethod · 0.80
getterFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…