MCPcopy
hub / github.com/reduxjs/redux-devtools / monitoring

Function monitoring

packages/redux-devtools-app/src/middlewares/api.ts:91–130  ·  view source on GitHub ↗
(request: MonitoringRequest)

Source from the content-addressed store, hash-verified

89 | Request;
90
91function monitoring(request: MonitoringRequest) {
92 if (request.type === 'DISCONNECTED') {
93 store.dispatch({
94 type: REMOVE_INSTANCE,
95 id: request.id,
96 });
97 return;
98 }
99 if (request.type === 'START') {
100 store.dispatch({ type: actions.EMIT, message: 'START', id: request.id });
101 return;
102 }
103
104 if (request.type === 'ERROR') {
105 store.dispatch(showNotification(request.payload));
106 return;
107 }
108
109 store.dispatch({
110 type: UPDATE_STATE,
111 request: (request as unknown as RequestWithData).data
112 ? { ...(request as unknown as RequestWithData).data, id: request.id }
113 : request,
114 });
115
116 const instances = store.getState().instances;
117 const instanceId = request.instanceId || request.id;
118 if (
119 instances.sync &&
120 instanceId === instances.selected &&
121 (request.type === 'ACTION' || request.type === 'STATE')
122 ) {
123 socket.emit('respond', {
124 type: 'SYNC',
125 state: stringify(instances.states[instanceId]),
126 id: request.id,
127 instanceId,
128 });
129 }
130}
131
132function subscribe(
133 channelName: string,

Callers

nothing calls this directly

Calls 2

showNotificationFunction · 0.90
stringifyFunction · 0.50

Tested by

no test coverage detected