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

Function validateProp

dash/dash-renderer/src/actions/dependencies.js:543–570  ·  view source on GitHub ↗
(id, idPath, rawProp, cls, callbacks)

Source from the content-addressed store, hash-verified

541 }
542
543 function validateProp(id, idPath, rawProp, cls, callbacks) {
544 const prop = rawProp.split('@')[0];
545 const component = path(idPath, layout);
546 const element = Registry.resolve(component);
547
548 // note: Flow components do not have propTypes, so we can't validate.
549 if (element && element.propTypes && !element.propTypes[prop]) {
550 // look for wildcard props (ie data-* etc)
551 for (const propName in element.propTypes) {
552 const last = propName.length - 1;
553 if (
554 propName.charAt(last) === '*' &&
555 prop.substr(0, last) === propName.substr(0, last)
556 ) {
557 return;
558 }
559 }
560 const {type, namespace} = component;
561 dispatchError('Invalid prop for this component', [
562 `Property "${prop}" was used with component ID:`,
563 ` ${JSON.stringify(id)}`,
564 `in one of the ${cls} items of a callback.`,
565 `This ID is assigned to a ${namespace}.${type} component`,
566 'in the layout, which does not support this property.',
567 tail(callbacks)
568 ]);
569 }
570 }
571
572 function validateIdPatternProp(id, property, cls, callbacks) {
573 resolveDeps()(paths)({id, property}).forEach(dep => {

Callers 3

validateIdPatternPropFunction · 0.85
validateStateFunction · 0.85
validateMapFunction · 0.85

Calls 2

tailFunction · 0.85
dispatchErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…