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

Function parseComponentId

dash/dash-renderer/src/observers/websocketObserver.ts:29–41  ·  view source on GitHub ↗

* Parse a component ID that may be a stringified JSON object. * This handles dict IDs like '{"index":0,"type":"output"}' that need * to be parsed back to objects for getPath to work correctly.

(
    componentId: string
)

Source from the content-addressed store, hash-verified

27 * to be parsed back to objects for getPath to work correctly.
28 */
29function parseComponentId(
30 componentId: string
31): string | Record<string, unknown> {
32 if (componentId.startsWith('{') && componentId.endsWith('}')) {
33 try {
34 return JSON.parse(componentId);
35 } catch {
36 // Not valid JSON, return as-is
37 return componentId;
38 }
39 }
40 return componentId;
41}
42
43/**
44 * Initialize the WebSocket observer.

Callers 2

processSetPropsFunction · 0.85
initializeWebSocketFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…