midterms: use null in static props
This commit is contained in:
parent
935bdd12a7
commit
7ce09ae39d
|
@ -59,13 +59,16 @@ const useUpdateContracts = (
|
||||||
if (contracts.some((c) => c === undefined)) return
|
if (contracts.some((c) => c === undefined)) return
|
||||||
|
|
||||||
// listen to contract updates
|
// listen to contract updates
|
||||||
const unsubs = contracts.map((c, i) =>
|
const unsubs = contracts
|
||||||
listenForContract(
|
.filter((c) => !!c)
|
||||||
c.id,
|
.map((c, i) =>
|
||||||
(newC) =>
|
listenForContract(
|
||||||
newC && setContracts(setAt(contracts, i, newC as CPMMBinaryContract))
|
c.id,
|
||||||
|
(newC) =>
|
||||||
|
newC &&
|
||||||
|
setContracts(setAt(contracts, i, newC as CPMMBinaryContract))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
return () => unsubs.forEach((u) => u())
|
return () => unsubs.forEach((u) => u())
|
||||||
}, [contracts, setContracts])
|
}, [contracts, setContracts])
|
||||||
|
|
||||||
|
|
|
@ -180,11 +180,15 @@ const governorMidterms: StateElectionMarket[] = [
|
||||||
|
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
const senateContracts = await Promise.all(
|
const senateContracts = await Promise.all(
|
||||||
senateMidterms.map((m) => getContractFromSlug(m.slug))
|
senateMidterms.map((m) =>
|
||||||
|
getContractFromSlug(m.slug).then((c) => c ?? null)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const governorContracts = await Promise.all(
|
const governorContracts = await Promise.all(
|
||||||
governorMidterms.map((m) => getContractFromSlug(m.slug))
|
governorMidterms.map((m) =>
|
||||||
|
getContractFromSlug(m.slug).then((c) => c ?? null)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user