Handle pushing to starterpack screen when unauthed (#4692)
This commit is contained in:
parent
91c4aa7c2d
commit
8ebf9cc4b1
6 changed files with 143 additions and 132 deletions
|
@ -50,7 +50,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||
const activeStarterPack = useActiveStarterPack()
|
||||
const {hasSession} = useSession()
|
||||
const shouldShowStarterPack = Boolean(activeStarterPack?.uri) && !hasSession
|
||||
|
||||
const [state, setState] = React.useState<State>({
|
||||
showLoggedOut: shouldShowStarterPack,
|
||||
requestedAccountSwitchTo: shouldShowStarterPack
|
||||
|
@ -60,25 +59,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||
: undefined,
|
||||
})
|
||||
|
||||
const [prevActiveStarterPack, setPrevActiveStarterPack] =
|
||||
React.useState(activeStarterPack)
|
||||
if (activeStarterPack?.uri !== prevActiveStarterPack?.uri) {
|
||||
setPrevActiveStarterPack(activeStarterPack)
|
||||
if (activeStarterPack) {
|
||||
setState(s => ({
|
||||
...s,
|
||||
showLoggedOut: true,
|
||||
requestedAccountSwitchTo: 'starterpack',
|
||||
}))
|
||||
} else {
|
||||
setState(s => ({
|
||||
...s,
|
||||
showLoggedOut: false,
|
||||
requestedAccountSwitchTo: undefined,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
const controls = React.useMemo<Controls>(
|
||||
() => ({
|
||||
setShowLoggedOut(show) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue