diff --git a/packages/desktop-client/src/components/budget/BudgetTable.jsx b/packages/desktop-client/src/components/budget/BudgetTable.jsx index 3000ebb1af4..587737fcd1b 100644 --- a/packages/desktop-client/src/components/budget/BudgetTable.jsx +++ b/packages/desktop-client/src/components/budget/BudgetTable.jsx @@ -57,14 +57,9 @@ export class BudgetTable extends Component { }); } } else { - let targetGroup; - - for (const group of categoryGroups) { - if (group.categories.find(cat => cat.id === targetId)) { - targetGroup = group; - break; - } - } + const targetGroup = categoryGroups.find(g => + g.categories.find(c => c.id === targetId), + ); this.props.onReorderCategory({ id, diff --git a/packages/desktop-client/src/components/budget/util.ts b/packages/desktop-client/src/components/budget/util.ts index 5039526ffe5..7ef871b7324 100644 --- a/packages/desktop-client/src/components/budget/util.ts +++ b/packages/desktop-client/src/components/budget/util.ts @@ -92,7 +92,7 @@ export function findSortDown( } const newIdx = idx + 1; - if (newIdx < arr.length - 1) { + if (newIdx <= arr.length - 1) { return { targetId: arr[newIdx].id }; } else { // Move to the end