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

Function AppProvider

dash/dash-renderer/src/AppProvider.react.tsx:13–58  ·  view source on GitHub ↗
({
    hooks = {
        layout_pre: null,
        layout_post: null,
        request_pre: null,
        request_post: null,
        callback_resolved: null,
        request_refresh_jwt: null
    }
}: any)

Source from the content-addressed store, hash-verified

11} from './observers/websocketObserver';
12
13const AppProvider = ({
14 hooks = {
15 layout_pre: null,
16 layout_post: null,
17 request_pre: null,
18 request_post: null,
19 callback_resolved: null,
20 request_refresh_jwt: null
21 }
22}: any) => {
23 const [{store}] = useState(() => new Store());
24
25 // Initialize WebSocket connection if enabled or if websocket config is available
26 // (for per-callback websocket=True)
27 useEffect(() => {
28 const config = getConfigFromDOM();
29 if (
30 config.websocket?.enabled ||
31 (config.websocket?.url && config.websocket?.worker_url)
32 ) {
33 // Add fetch config for consistency
34 const fullConfig = {
35 ...config,
36 fetch: {
37 credentials: 'same-origin',
38 headers: {
39 Accept: 'application/json',
40 'Content-Type': 'application/json'
41 }
42 }
43 };
44 initializeWebSocket(store, fullConfig);
45 }
46
47 // Cleanup on unmount
48 return () => {
49 disconnectWebSocket();
50 };
51 }, [store]);
52
53 return (
54 <Provider store={store}>
55 <AppContainer hooks={hooks} />
56 </Provider>
57 );
58};
59
60AppProvider.propTypes = {
61 hooks: PropTypes.shape({

Callers

nothing calls this directly

Calls 5

useStateFunction · 0.90
useEffectFunction · 0.90
initializeWebSocketFunction · 0.90
disconnectWebSocketFunction · 0.90
getConfigFromDOMFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…