From ebba6ec4d3dd8239e2e047b69316aedf4c3ff218 Mon Sep 17 00:00:00 2001 From: Matthieu Bergel Date: Tue, 30 Jan 2024 14:15:16 +0000 Subject: [PATCH] feat(wp): dereference tables in postUpdatedHook sync --- baker/postUpdatedHook.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/baker/postUpdatedHook.ts b/baker/postUpdatedHook.ts index 4f7feb043f7..bdcc5b070b4 100644 --- a/baker/postUpdatedHook.ts +++ b/baker/postUpdatedHook.ts @@ -14,6 +14,7 @@ import * as wpdb from "../db/wpdb.js" import * as db from "../db/db.js" import { buildReusableBlocksResolver, + buildTablePressResolver, getLinksToAddAndRemoveForPost, } from "../db/syncPostsToGrapher.js" import { postsTable, select } from "../db/model/Post.js" @@ -94,6 +95,7 @@ const syncPostToGrapher = async ( [postId, postId, postId, postId] ) const dereferenceReusableBlocksFn = await buildReusableBlocksResolver() + const dereferenceTablePressFn = await buildTablePressResolver() const matchingRows = await db.knexTable(postsTable).where({ id: postId }) const existsInGrapher = !!matchingRows.length @@ -137,8 +139,8 @@ const syncPostToGrapher = async ( // Delete from grapher await transaction.table(postsTable).where({ id: postId }).delete() else if (postRow) { - const contentWithBlocksInlined = dereferenceReusableBlocksFn( - postRow.content + const contentWithBlocksInlined = dereferenceTablePressFn( + dereferenceReusableBlocksFn(postRow.content) ) postRow.content = contentWithBlocksInlined