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

Function ExternalWrapper

dash/dash-renderer/src/wrapper/ExternalWrapper.tsx:22–64  ·  view source on GitHub ↗

* For rendering components that are out of the regular layout tree.

({component, componentPath, temp = false}: Props)

Source from the content-addressed store, hash-verified

20 * For rendering components that are out of the regular layout tree.
21 */
22function ExternalWrapper({component, componentPath, temp = false}: Props) {
23 const dispatch: any = useDispatch();
24 const [inserted, setInserted] = useState(false);
25
26 useEffect(() => {
27 // Give empty props for the inserted components.
28 // The props will come from the parent so they can be updated.
29 dispatch(
30 addComponentToLayout({
31 component,
32 componentPath
33 })
34 );
35 setInserted(true);
36 return () => {
37 if (temp) {
38 dispatch(removeComponent({componentPath}));
39 }
40 };
41 }, []);
42
43 useEffect(() => {
44 batch(() => {
45 dispatch(
46 updateProps({itempath: componentPath, props: component.props})
47 );
48 if (component.props.id) {
49 dispatch(
50 notifyObservers({
51 id: component.props.id,
52 props: component.props
53 })
54 );
55 }
56 });
57 }, [component.props]);
58
59 if (!inserted) {
60 return null;
61 }
62 // Render a wrapper with the actual props.
63 return <DashWrapper componentPath={componentPath} />;
64}
65export default ExternalWrapper;

Callers

nothing calls this directly

Calls 5

useStateFunction · 0.90
useEffectFunction · 0.90
addComponentToLayoutFunction · 0.90
updatePropsFunction · 0.90
notifyObserversFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…