home: handle undefined props

This commit is contained in:
mantikoros 2022-01-22 18:32:50 -06:00
parent cff2611582
commit 7c124c1390

View File

@ -71,11 +71,15 @@ const Home = (props: {
const user = useUser()
const contracts = useContracts() ?? props.activeContracts
const initialActiveContracts = props.activeContracts ?? []
const contracts = useContracts()
const recentComments = useRecentComments()
const activeContracts = recentComments
? findActiveContracts(contracts, recentComments)
: props.activeContracts
const activeContracts =
recentComments && contracts
? findActiveContracts(contracts, recentComments)
: initialActiveContracts
if (user === null) {
Router.replace('/')