From de8e4df04c4d20e5ec15537f491f961926f94475 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 19 Sep 2022 16:07:27 -0500 Subject: [PATCH] Revalidate static props for new comments --- functions/src/on-create-comment-on-contract.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/functions/src/on-create-comment-on-contract.ts b/functions/src/on-create-comment-on-contract.ts index 6bb568ff..101b085c 100644 --- a/functions/src/on-create-comment-on-contract.ts +++ b/functions/src/on-create-comment-on-contract.ts @@ -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