Skip to content

Commit 71007bb

Browse files
committed
Break up tag cleanup
1 parent 9c22dd4 commit 71007bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

api/routes/update.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,13 @@ async function statelyUpdate(
274274
// We want to group save search and search updates together
275275
const actionKey = (u: ProfileUpdate) => (u.action === 'save_search' ? 'search' : u.action);
276276

277-
const sortedUpdates = sortBy(updates, [actionKey]);
277+
const sortedUpdates = sortBy(updates, [actionKey]).flatMap((u): ProfileUpdate[] => {
278+
// Separate out tag_cleanup updates into individual updates
279+
if (u.action === 'tag_cleanup') {
280+
return u.payload.map((p) => ({ action: 'tag_cleanup', payload: [p] }));
281+
}
282+
return [u];
283+
});
278284

279285
for (const updateChunk of chunk(sortedUpdates, 25)) {
280286
await client.transaction(async (txn) => {

0 commit comments

Comments
 (0)