mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: product cache revalidation on product create (#2538)
This commit is contained in:
@@ -273,6 +273,11 @@ export const createProduct = async (
|
||||
select: selectProduct,
|
||||
});
|
||||
|
||||
productCache.revalidate({
|
||||
id: product.id,
|
||||
teamId: product.teamId,
|
||||
});
|
||||
|
||||
const devEnvironment = await createEnvironment(product.id, {
|
||||
type: "development",
|
||||
});
|
||||
@@ -281,9 +286,11 @@ export const createProduct = async (
|
||||
type: "production",
|
||||
});
|
||||
|
||||
return await updateProduct(product.id, {
|
||||
const updatedProduct = await updateProduct(product.id, {
|
||||
environments: [devEnvironment, prodEnvironment],
|
||||
});
|
||||
|
||||
return updatedProduct;
|
||||
} catch (error) {
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
throw new DatabaseError(error.message);
|
||||
|
||||
Reference in New Issue
Block a user