Skip to content

A local-first personal finance app

Fix a bug in confirm category delete (#1351)

Sean Tsai723cbcf99cb3
diff --git a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js
index 9c717426cc..ae4b5b8026 100644
--- a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js
+++ b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js
@@ -69,7 +69,20 @@ export default function ConfirmCategoryDelete({
<View style={{ flex: 1, marginLeft: 10, marginRight: 30 }}>
<CategoryAutocomplete
- categoryGroups={categoryGroups}
+ categoryGroups={
+ group
+ ? categoryGroups.filter(
+ g => g.id !== group.id && !!g.is_income === isIncome,
+ )
+ : categoryGroups
+ .filter(g => !!g.is_income === isIncome)
+ .map(g => ({
+ ...g,
+ categories: g.categories.filter(
+ c => c.id !== category.id,
+ ),
+ }))
+ }
value={transferCategory}
inputProps={{
placeholder: 'Select category...',
diff --git a/upcoming-release-notes/1351.md b/upcoming-release-notes/1351.md
new file mode 100644
index 0000000000..b16dabf45b
--- /dev/null
+++ b/upcoming-release-notes/1351.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [aleetsaiya]
+---
+
+Fix a bug that user can transfer budget to the category (or group) which user want to delete
\ No newline at end of file