Skip to content

Commit 8cb03d7

Browse files
committed
fix(wordpress): use ?? instead of || for zero-valued numeric fields in delete_category/tag
count and parent can legitimately be 0 (empty term, top-level category); || was dropping those values, same antipattern already fixed for `deleted` in this PR. Flagged independently by Greptile and Cursor Bugbot.
1 parent 8fa6841 commit 8cb03d7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

apps/sim/tools/wordpress/delete_category.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ export const deleteCategoryTool: ToolConfig<
6060
output: {
6161
deleted: data.deleted ?? true,
6262
category: {
63-
id: data.id || data.previous?.id,
64-
count: data.count || data.previous?.count,
63+
id: data.id ?? data.previous?.id,
64+
count: data.count ?? data.previous?.count,
6565
description: data.description || data.previous?.description,
6666
link: data.link || data.previous?.link,
6767
name: data.name || data.previous?.name,
6868
slug: data.slug || data.previous?.slug,
6969
taxonomy: data.taxonomy || data.previous?.taxonomy,
70-
parent: data.parent || data.previous?.parent,
70+
parent: data.parent ?? data.previous?.parent,
7171
},
7272
},
7373
}

apps/sim/tools/wordpress/delete_tag.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ export const deleteTagTool: ToolConfig<WordPressDeleteTagParams, WordPressDelete
5757
output: {
5858
deleted: data.deleted ?? true,
5959
tag: {
60-
id: data.id || data.previous?.id,
61-
count: data.count || data.previous?.count,
60+
id: data.id ?? data.previous?.id,
61+
count: data.count ?? data.previous?.count,
6262
description: data.description || data.previous?.description,
6363
link: data.link || data.previous?.link,
6464
name: data.name || data.previous?.name,

0 commit comments

Comments
 (0)