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 user = useUser()
const contracts = useContracts() ?? props.activeContracts const initialActiveContracts = props.activeContracts ?? []
const contracts = useContracts()
const recentComments = useRecentComments() const recentComments = useRecentComments()
const activeContracts = recentComments
const activeContracts =
recentComments && contracts
? findActiveContracts(contracts, recentComments) ? findActiveContracts(contracts, recentComments)
: props.activeContracts : initialActiveContracts
if (user === null) { if (user === null) {
Router.replace('/') Router.replace('/')