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

Function processSetProps

dash/dash-renderer/src/observers/websocketObserver.ts:79–133  ·  view source on GitHub ↗
(payload: SetPropsPayload)

Source from the content-addressed store, hash-verified

77
78 // Helper to process a single set_props payload
79 const processSetProps = (payload: SetPropsPayload) => {
80 const {componentId, props: rawProps} = payload;
81 const parsedId = parseComponentId(componentId);
82 const state = store.getState();
83 const componentPath = getPath(state.paths, parsedId);
84
85 if (!componentPath) {
86 console.warn(
87 `SET_PROPS: Component ${componentId} not found in layout`
88 );
89 return;
90 }
91
92 // Get old component for Patch processing and path recomputation
93 const oldComponent = path(componentPath, state.layout) as Record<
94 string,
95 unknown
96 > | null;
97 const oldProps = (oldComponent?.props || {}) as Record<string, unknown>;
98
99 // Process props to handle Patch objects
100 const processedProps = parsePatchProps(rawProps, oldProps);
101
102 // Update the component props
103 store.dispatch(
104 updateProps({
105 props: processedProps,
106 itempath: componentPath,
107 renderType: 'websocket'
108 }) as any
109 );
110
111 // Notify observers
112 store.dispatch(
113 notifyObservers({id: parsedId, props: processedProps}) as any
114 );
115
116 // Recompute paths for any new child components
117 if (oldComponent) {
118 const updatedState = store.getState();
119 store.dispatch(
120 setPaths(
121 computePaths(
122 {
123 ...oldComponent,
124 props: {...oldProps, ...processedProps}
125 },
126 [...componentPath],
127 updatedState.paths,
128 updatedState.paths.events
129 )
130 ) as any
131 );
132 }
133 };
134
135 // Handle single SET_PROPS message
136 workerClient.onSetProps = processSetProps;

Callers 1

initializeWebSocketFunction · 0.85

Calls 7

getPathFunction · 0.90
parsePatchPropsFunction · 0.90
updatePropsFunction · 0.90
notifyObserversFunction · 0.90
computePathsFunction · 0.90
parseComponentIdFunction · 0.85
getStateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…