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

Function setHydratedProps

dash/dash-renderer/src/wrapper/DashWrapper.tsx:234–446  ·  view source on GitHub ↗
(component: any, componentProps: any)

Source from the content-addressed store, hash-verified

232 }
233
234 const setHydratedProps = (component: any, componentProps: any) => {
235 // Hydrate components props
236 const childrenProps = pathOr(
237 [],
238 ['children_props', component?.namespace, component?.type],
239 config
240 );
241 let props = mergeRight(dissoc('children', componentProps), extraProps);
242
243 for (let i = 0; i < childrenProps.length; i++) {
244 const childrenProp: string = childrenProps[i];
245 let childNewRender: any = 0;
246 if (
247 childrenProp
248 .split('.')[0]
249 .replace('[]', '')
250 .replace('{}', '') in changedProps ||
251 newRender.current ||
252 !renderH
253 ) {
254 childNewRender = {};
255 }
256 const handleObject = (obj: any, opath: DashLayoutPath) => {
257 return mapObjIndexed(
258 (node, k) =>
259 wrapChildrenProp(node, [...opath, k], childNewRender),
260 obj
261 );
262 };
263
264 if (childrenProp.includes('.')) {
265 let childrenPath: DashLayoutPath = childrenProp.split('.');
266 let node: any;
267 let nodeValue: any;
268 if (childrenProp.includes('[]')) {
269 const frontPath: string[] = [],
270 backPath: string[] = [];
271 let found = false,
272 hasObject = false;
273 // At first the childrenPath is always a list of strings.
274 (childrenPath as string[]).forEach(p => {
275 if (!found) {
276 if (p.includes('[]')) {
277 found = true;
278 if (p.includes('{}')) {
279 hasObject = true;
280 frontPath.push(
281 p.replace('{}', '').replace('[]', '')
282 );
283 } else {
284 frontPath.push(p.replace('[]', ''));
285 }
286 } else if (p.includes('{}')) {
287 hasObject = true;
288 frontPath.push(p.replace('{}', ''));
289 } else {
290 frontPath.push(p);
291 }

Callers 1

hydrateFuncFunction · 0.85

Calls 3

stringifyIdFunction · 0.90
handleObjectFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…