Move contract hook back into ContractPageContent. (Fixes going back to home.)
This commit is contained in:
parent
05f1da430c
commit
dcaddd6a1a
|
@ -86,13 +86,13 @@ export default function ContractPage(props: {
|
|||
slug: '',
|
||||
}
|
||||
|
||||
const contract = useContractWithPreload(props.contract)
|
||||
|
||||
const inIframe = useIsIframe()
|
||||
if (inIframe) {
|
||||
return <ContractEmbedPage {...props} />
|
||||
}
|
||||
|
||||
const { contract } = props
|
||||
|
||||
if (!contract) {
|
||||
return <Custom404 />
|
||||
}
|
||||
|
@ -103,7 +103,9 @@ export default function ContractPage(props: {
|
|||
export function ContractPageContent(
|
||||
props: Parameters<typeof ContractPage>[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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user