Must listen to contract updates for probs to update (#482)
* Must listen to contract updates * remove unused import * Rename liveContract
This commit is contained in:
parent
789bbced5f
commit
ee816d6552
|
@ -10,7 +10,7 @@ import {
|
||||||
} from './activity-items'
|
} from './activity-items'
|
||||||
import { FeedItems } from './feed-items'
|
import { FeedItems } from './feed-items'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { useContract } from 'web/hooks/use-contract'
|
import { useContractWithPreload } from 'web/hooks/use-contract'
|
||||||
|
|
||||||
export function ContractActivity(props: {
|
export function ContractActivity(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
|
@ -30,17 +30,17 @@ export function ContractActivity(props: {
|
||||||
}) {
|
}) {
|
||||||
const { user, mode, contractPath, className, betRowClassName } = props
|
const { user, mode, contractPath, className, betRowClassName } = props
|
||||||
|
|
||||||
const contract = useContract(props.contract.id) ?? props.contract
|
const contract = useContractWithPreload(props.contract) ?? props.contract
|
||||||
|
|
||||||
const updatedComments =
|
const updatedComments =
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
mode === 'only-recent' ? undefined : useComments(contract.id)
|
mode === 'only-recent' ? undefined : useComments(contract.id)
|
||||||
const comments = updatedComments ?? props.comments
|
const comments = updatedComments ?? props.comments
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
const updatedBets =
|
||||||
const updatedBets = mode === 'only-recent' ? undefined : useBets(contract.id)
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
|
mode === 'only-recent' ? undefined : useBets(contract.id)
|
||||||
const bets = (updatedBets ?? props.bets).filter((bet) => !bet.isRedemption)
|
const bets = (updatedBets ?? props.bets).filter((bet) => !bet.isRedemption)
|
||||||
|
|
||||||
const items =
|
const items =
|
||||||
mode === 'only-recent'
|
mode === 'only-recent'
|
||||||
? getRecentContractActivityItems(contract, bets, comments, user, {
|
? getRecentContractActivityItems(contract, bets, comments, user, {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user