WSOD when trying to create account from starter pack on non-default provider (#10970)

This commit is contained in:
Christian Schmidt
2026-06-30 10:26:20 +02:00
committed by GitHub
parent 75e2c40ba4
commit 43d2f939c2
+17 -10
View File
@@ -1,4 +1,10 @@
import {createContext, useContext, useState} from 'react'
import {
createContext,
type Dispatch,
type SetStateAction,
useContext,
useState,
} from 'react'
import {logger} from '#/logger'
@@ -16,11 +22,11 @@ type GroupChatJoinRequestLanding = {
type LandingType = StarterPackLanding | GroupChatJoinRequestLanding | undefined
type SetContext = (v: LandingType) => void
type SetContext = Dispatch<SetStateAction<LandingType>>
const stateContext = createContext<LandingType>(undefined)
stateContext.displayName = 'ActiveLandingStateContext'
const setContext = createContext<SetContext>((_: LandingType) => {})
const setContext = createContext<SetContext>(() => {})
setContext.displayName = 'ActiveLandingSetContext'
export function Provider({children}: {children: React.ReactNode}) {
@@ -45,17 +51,18 @@ export const useActiveStarterPack = () => {
export const useSetActiveStarterPack = () => {
const setLanding = useSetActiveLanding()
const currentLanding = useActiveLanding()
return (pack: {uri: string; isClip?: boolean} | undefined) => {
if (!pack) {
setLanding(undefined)
} else {
if (currentLanding && currentLanding.type !== 'starterpack') {
logger.debug(
`[landing] Replacing ${currentLanding.type} landing with starterpack`,
)
}
setLanding({type: 'starterpack', ...pack})
setLanding(currentLanding => {
if (currentLanding && currentLanding.type !== 'starterpack') {
logger.debug(
`[landing] Replacing ${currentLanding.type} landing with starterpack`,
)
}
return {type: 'starterpack', ...pack}
})
}
}
}