about summary refs log tree commit diff
path: root/src/components/PolicyUpdateOverlay/index.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2025-08-07 14:55:19 -0500
committerGitHub <noreply@github.com>2025-08-07 14:55:19 -0500
commit11c9931fd2bc9db8a6e4e71ae04d71051f63191c (patch)
treeed2de0262a18a8971d23214009afa6bdc172f9c1 /src/components/PolicyUpdateOverlay/index.tsx
parentc0593e49792af987b0c7accd6301f235d132030f (diff)
downloadvoidsky-11c9931fd2bc9db8a6e4e71ae04d71051f63191c.tar.zst
Fix policy overlay logic (#8793)
* Only enable policy update overlay once the actual Overlay mounts (after onboarding and all that)

* Disable policy overlay in e2e

* Add comments

* Add extra insurance

* Rm log
Diffstat (limited to 'src/components/PolicyUpdateOverlay/index.tsx')
-rw-r--r--src/components/PolicyUpdateOverlay/index.tsx14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/components/PolicyUpdateOverlay/index.tsx b/src/components/PolicyUpdateOverlay/index.tsx
index 1900dc27f..f30da4334 100644
--- a/src/components/PolicyUpdateOverlay/index.tsx
+++ b/src/components/PolicyUpdateOverlay/index.tsx
@@ -1,18 +1,26 @@
+import {useEffect} from 'react'
 import {View} from 'react-native'
 
 import {isIOS} from '#/platform/detection'
 import {atoms as a} from '#/alf'
 import {FullWindowOverlay} from '#/components/FullWindowOverlay'
-import {usePolicyUpdateStateContext} from '#/components/PolicyUpdateOverlay/context'
+import {usePolicyUpdateContext} from '#/components/PolicyUpdateOverlay/context'
 import {Portal} from '#/components/PolicyUpdateOverlay/Portal'
 import {Content} from '#/components/PolicyUpdateOverlay/updates/202508'
 
 export {Provider} from '#/components/PolicyUpdateOverlay/context'
-export {usePolicyUpdateStateContext} from '#/components/PolicyUpdateOverlay/context'
+export {usePolicyUpdateContext} from '#/components/PolicyUpdateOverlay/context'
 export {Outlet} from '#/components/PolicyUpdateOverlay/Portal'
 
 export function PolicyUpdateOverlay() {
-  const state = usePolicyUpdateStateContext()
+  const {state, setIsReadyToShowOverlay} = usePolicyUpdateContext()
+
+  useEffect(() => {
+    /**
+     * Tell the context that we are ready to show the overlay.
+     */
+    setIsReadyToShowOverlay()
+  }, [setIsReadyToShowOverlay])
 
   /*
    * See `window.clearNux` example in `/state/queries/nuxs` for a way to clear