home: handle undefined props
This commit is contained in:
parent
cff2611582
commit
7c124c1390
|
@ -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
|
|
||||||
? findActiveContracts(contracts, recentComments)
|
const activeContracts =
|
||||||
: props.activeContracts
|
recentComments && contracts
|
||||||
|
? findActiveContracts(contracts, recentComments)
|
||||||
|
: initialActiveContracts
|
||||||
|
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
Router.replace('/')
|
Router.replace('/')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user