Add extra insurance
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
|
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
import {Provider as PortalProvider} from '#/components/PolicyUpdateOverlay/Portal'
|
import {Provider as PortalProvider} from '#/components/PolicyUpdateOverlay/Portal'
|
||||||
import {
|
import {
|
||||||
type PolicyUpdateState,
|
type PolicyUpdateState,
|
||||||
@@ -39,10 +40,16 @@ export function usePolicyUpdateContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Provider({children}: {children?: ReactNode}) {
|
export function Provider({children}: {children?: ReactNode}) {
|
||||||
|
const {hasSession} = useSession()
|
||||||
const [isReadyToShowOverlay, setIsReadyToShowOverlay] = useState(false)
|
const [isReadyToShowOverlay, setIsReadyToShowOverlay] = useState(false)
|
||||||
|
console.log({
|
||||||
|
isReadyToShowOverlay,
|
||||||
|
hasSession,
|
||||||
|
})
|
||||||
const state = usePolicyUpdateState({
|
const state = usePolicyUpdateState({
|
||||||
// only enable the policy update overlay in non-test environments
|
// only enable the policy update overlay in non-test environments
|
||||||
enabled: isReadyToShowOverlay && process.env.NODE_ENV !== 'test',
|
enabled:
|
||||||
|
isReadyToShowOverlay && hasSession && process.env.NODE_ENV !== 'test',
|
||||||
})
|
})
|
||||||
|
|
||||||
const ctx = useMemo(
|
const ctx = useMemo(
|
||||||
|
|||||||
Reference in New Issue
Block a user