home: handle undefined props
This commit is contained in:
parent
cff2611582
commit
7c124c1390
|
@ -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('/')
|
||||
|
|
Loading…
Reference in New Issue
Block a user