Revalidate static props for new comments

This commit is contained in:
James Grugett 2022-09-19 16:07:27 -05:00
parent 1a82ce193d
commit de8e4df04c

View File

@ -1,7 +1,13 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { compact } from 'lodash'
import { getContract, getUser, getValues } from './utils'
import {
getContract,
getContractPath,
getUser,
getValues,
revalidateStaticProps,
} from './utils'
import { ContractComment } from '../../common/comment'
import { Bet } from '../../common/bet'
import { Answer } from '../../common/answer'
@ -34,6 +40,8 @@ export const onCreateCommentOnContract = functions
contractQuestion: contract.question,
})
await revalidateStaticProps(getContractPath(contract))
const comment = change.data() as ContractComment
const lastCommentTime = comment.createdTime