[PR #6971] [CLOSED] [WIP] Fix: new categories always rejected as duplicates #41285

Closed
opened 2026-04-23 14:05:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6971
Author: @sbmdjordan
Created: 2/14/2026
Status: Closed

Base: masterHead: feat/daily-average-remaining


📝 Commits (3)

  • 59de190 Add daily average remaining display to budget categories
  • cf217a5 Add GitHub Actions workflow for custom Docker image
  • 586dc43 Fix bug: new categories always rejected as duplicates

📊 Changes

8 files changed (+185 additions, -5 deletions)

View changed files

.github/workflows/build-custom.yml (+51 -0)
Dockerfile.custom (+83 -0)
📝 packages/desktop-client/src/budget/mutations.ts (+4 -5)
📝 packages/desktop-client/src/components/budget/BalanceWithCarryover.tsx (+41 -0)
📝 packages/desktop-client/src/components/budget/envelope/EnvelopeBudgetComponents.tsx (+1 -0)
📝 packages/desktop-client/src/components/budget/tracking/TrackingBudgetComponents.tsx (+1 -0)
📝 packages/desktop-client/src/components/mobile/budget/BalanceCell.tsx (+3 -0)
📝 packages/desktop-client/src/components/mobile/budget/ExpenseCategoryListItem.tsx (+1 -0)

📄 Description

Summary

  • Fixed a bug in useSaveCategoryMutation where creating a new category in a group that already contains categories always triggers the "already exists" error, regardless of the name entered
  • The duplicate name check was unconditionally returning true for new categories (id === 'new') instead of comparing names
  • Now properly checks if the name actually matches an existing category before rejecting

Before

const exists = categoriesInGroup.some(c =>
  category.id === 'new'
    ? true  // always returns true — any existing category = "duplicate"
    : c.id !== category.id &&
      c.name.toUpperCase() === category.name.toUpperCase(),
);

After

const exists = categoriesInGroup.some(
  c =>
    (category.id === 'new' || c.id !== category.id) &&
    c.name.toUpperCase() === category.name.toUpperCase(),
);

Test plan

  • Create a new budget with default categories
  • Try adding a new category (e.g., "Pluto") to any existing group → previously failed with "already exists", now works correctly
  • Verify that actual duplicate names are still rejected
  • Verify renaming a category to a name that already exists in the group is still rejected

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6971 **Author:** [@sbmdjordan](https://github.com/sbmdjordan) **Created:** 2/14/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feat/daily-average-remaining` --- ### 📝 Commits (3) - [`59de190`](https://github.com/actualbudget/actual/commit/59de1903958f7b532372627559b10b7875c41e80) Add daily average remaining display to budget categories - [`cf217a5`](https://github.com/actualbudget/actual/commit/cf217a5f4719ff774d34ce078ca1dc301eab8b30) Add GitHub Actions workflow for custom Docker image - [`586dc43`](https://github.com/actualbudget/actual/commit/586dc43456e225290a36a036b84ad05de3fb9ebc) Fix bug: new categories always rejected as duplicates ### 📊 Changes **8 files changed** (+185 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/build-custom.yml` (+51 -0) ➕ `Dockerfile.custom` (+83 -0) 📝 `packages/desktop-client/src/budget/mutations.ts` (+4 -5) 📝 `packages/desktop-client/src/components/budget/BalanceWithCarryover.tsx` (+41 -0) 📝 `packages/desktop-client/src/components/budget/envelope/EnvelopeBudgetComponents.tsx` (+1 -0) 📝 `packages/desktop-client/src/components/budget/tracking/TrackingBudgetComponents.tsx` (+1 -0) 📝 `packages/desktop-client/src/components/mobile/budget/BalanceCell.tsx` (+3 -0) 📝 `packages/desktop-client/src/components/mobile/budget/ExpenseCategoryListItem.tsx` (+1 -0) </details> ### 📄 Description ## Summary - Fixed a bug in `useSaveCategoryMutation` where creating a new category in a group that already contains categories always triggers the "already exists" error, regardless of the name entered - The duplicate name check was unconditionally returning `true` for new categories (`id === 'new'`) instead of comparing names - Now properly checks if the name actually matches an existing category before rejecting ## Before ```js const exists = categoriesInGroup.some(c => category.id === 'new' ? true // always returns true — any existing category = "duplicate" : c.id !== category.id && c.name.toUpperCase() === category.name.toUpperCase(), ); ``` ## After ```js const exists = categoriesInGroup.some( c => (category.id === 'new' || c.id !== category.id) && c.name.toUpperCase() === category.name.toUpperCase(), ); ``` ## Test plan - [x] Create a new budget with default categories - [x] Try adding a new category (e.g., "Pluto") to any existing group → previously failed with "already exists", now works correctly - [x] Verify that actual duplicate names are still rejected - [x] Verify renaming a category to a name that already exists in the group is still rejected 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 14:05:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#41285