Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
2dd34f0
1
Parent(s):
5cc7f12
woops
Browse files
src/components/interface/latent-engine/core/useSetupIframeOnce.ts
CHANGED
@@ -11,7 +11,7 @@ export function useSetupIframeOnce() {
|
|
11 |
const setDomElement = useChildController(s => s.setDomElement)
|
12 |
const canUseBellhop = useChildController((s) => s.canUseBellhop)
|
13 |
const setCanUseBellhop = useChildController((s) => s.setCanUseBellhop)
|
14 |
-
const
|
15 |
const setHasLoadedBellhop = useChildController((s) => s.setHasLoadedBellhop)
|
16 |
const onMessage = useChildController((s) => s.onMessage)
|
17 |
const sendMessage = useChildController((s) => s.sendMessage)
|
@@ -24,7 +24,7 @@ export function useSetupIframeOnce() {
|
|
24 |
const domElement = ref.current
|
25 |
|
26 |
useEffect(() => {
|
27 |
-
if (!domElement || !
|
28 |
// when we are detecting that we are not in an iframe
|
29 |
|
30 |
if (canUseBellhop) {
|
@@ -37,7 +37,7 @@ export function useSetupIframeOnce() {
|
|
37 |
setCanUseBellhop(true)
|
38 |
}
|
39 |
|
40 |
-
if (
|
41 |
// no need to connect twice
|
42 |
return
|
43 |
} else {
|
@@ -59,7 +59,7 @@ export function useSetupIframeOnce() {
|
|
59 |
setCanUseBellhop(false)
|
60 |
}
|
61 |
}
|
62 |
-
}, [domElement, canUseBellhop,
|
63 |
|
64 |
return useChildController
|
65 |
}
|
|
|
11 |
const setDomElement = useChildController(s => s.setDomElement)
|
12 |
const canUseBellhop = useChildController((s) => s.canUseBellhop)
|
13 |
const setCanUseBellhop = useChildController((s) => s.setCanUseBellhop)
|
14 |
+
const hasLoadedBellhop = useChildController((s) => s.hasLoadedBellhop)
|
15 |
const setHasLoadedBellhop = useChildController((s) => s.setHasLoadedBellhop)
|
16 |
const onMessage = useChildController((s) => s.onMessage)
|
17 |
const sendMessage = useChildController((s) => s.sendMessage)
|
|
|
24 |
const domElement = ref.current
|
25 |
|
26 |
useEffect(() => {
|
27 |
+
if (!domElement || !hasLoadedBellhop) {
|
28 |
// when we are detecting that we are not in an iframe
|
29 |
|
30 |
if (canUseBellhop) {
|
|
|
37 |
setCanUseBellhop(true)
|
38 |
}
|
39 |
|
40 |
+
if (hasLoadedBellhop) {
|
41 |
// no need to connect twice
|
42 |
return
|
43 |
} else {
|
|
|
59 |
setCanUseBellhop(false)
|
60 |
}
|
61 |
}
|
62 |
+
}, [domElement, canUseBellhop, hasLoadedBellhop, setHasLoadedBellhop, setCanUseBellhop])
|
63 |
|
64 |
return useChildController
|
65 |
}
|