From 5349e46bc4e85b68ef3aa26c5e5c7ca08779c358 Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 14 Jun 2024 16:22:20 -0700 Subject: [PATCH] validate records --- .../StarterPack/StarterPackLandingScreen.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/screens/StarterPack/StarterPackLandingScreen.tsx b/src/screens/StarterPack/StarterPackLandingScreen.tsx index ab81e790cf..4bee5c0d38 100644 --- a/src/screens/StarterPack/StarterPackLandingScreen.tsx +++ b/src/screens/StarterPack/StarterPackLandingScreen.tsx @@ -55,15 +55,22 @@ export function LandingScreen({ isError: isErrorStarterPack, } = useStarterPackQuery({did, rkey}) + const isValid = + starterPack && + AppBskyGraphDefs.validateStarterPackView(starterPack) && + AppBskyGraphStarterpack.validateRecord(starterPack.record) + React.useEffect(() => { - if (isErrorDid || isErrorStarterPack) { + if (isErrorDid || isErrorStarterPack || (starterPack && !isValid)) { setScreenState(LoggedOutScreenState.S_LoginOrCreateAccount) } - }, [isErrorDid, isErrorStarterPack, setScreenState]) + }, [isErrorDid, isErrorStarterPack, setScreenState, isValid, starterPack]) - if (!did || !starterPack) { + if (!did || !starterPack || !isValid) { return ( - + ) }