diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx
index 3f21099f..c8f3bdb6 100644
--- a/web/pages/[username]/[contractSlug].tsx
+++ b/web/pages/[username]/[contractSlug].tsx
@@ -86,13 +86,13 @@ export default function ContractPage(props: {
slug: '',
}
- const contract = useContractWithPreload(props.contract)
-
const inIframe = useIsIframe()
if (inIframe) {
return
}
+ const { contract } = props
+
if (!contract) {
return
}
@@ -103,7 +103,9 @@ export default function ContractPage(props: {
export function ContractPageContent(
props: Parameters[0] & { contract: Contract }
) {
- const { contract, backToHome, comments } = props
+ const { backToHome, comments } = props
+
+ const contract = useContractWithPreload(props.contract) ?? props.contract
const bets = useBets(contract.id) ?? props.bets
// Sort for now to see if bug is fixed.
diff --git a/web/pages/home.tsx b/web/pages/home.tsx
index 20a58492..ccf9a585 100644
--- a/web/pages/home.tsx
+++ b/web/pages/home.tsx
@@ -9,7 +9,6 @@ import { ContractSearch } from 'web/components/contract-search'
import { Contract } from 'common/contract'
import { ContractPageContent } from './[username]/[contractSlug]'
import { getContractFromSlug } from 'web/lib/firebase/contracts'
-import { useContractWithPreload } from 'web/hooks/use-contract'
const Home = () => {
const user = useUser()
@@ -105,9 +104,7 @@ const useContractPage = () => {
if (contract) window.scrollTo(0, 0)
}, [contract])
- const updatedContract = useContractWithPreload(contract)
-
- return [updatedContract, setContract] as const
+ return [contract, setContract] as const
}
export default Home