diff --git a/frontend/src/components/TransactionsTable.tsx b/frontend/src/components/TransactionsTable.tsx
index bf624b2..d65837e 100644
--- a/frontend/src/components/TransactionsTable.tsx
+++ b/frontend/src/components/TransactionsTable.tsx
@@ -366,6 +366,9 @@ export default function TransactionsTable() {
.reduce((sum: number, t: Transaction) => sum + t.transaction_value, 0)
);
+ // Get currency from first transaction, fallback to EUR
+ const displayCurrency = transactions.length > 0 ? transactions[0].transaction_currency : "EUR";
+
const stats = {
totalCount: pagination?.total || 0,
pageCount: transactions.length,
@@ -411,7 +414,7 @@ export default function TransactionsTable() {
Income
- +{formatCurrency(stats.totalIncome, transactions[0]?.transaction_currency || "EUR")}
+ +{formatCurrency(stats.totalIncome, displayCurrency)}
@@ -425,7 +428,7 @@ export default function TransactionsTable() {
Expenses
- -{formatCurrency(stats.totalExpenses, transactions[0]?.transaction_currency || "EUR")}
+ -{formatCurrency(stats.totalExpenses, displayCurrency)}
@@ -444,7 +447,7 @@ export default function TransactionsTable() {
}`}
>
{stats.netChange >= 0 ? "+" : ""}
- {formatCurrency(stats.netChange, transactions[0]?.transaction_currency || "EUR")}
+ {formatCurrency(stats.netChange, displayCurrency)}
{stats.netChange >= 0 ? (
diff --git a/frontend/src/components/filters/FilterBar.tsx b/frontend/src/components/filters/FilterBar.tsx
index 2b60ab4..1d83c45 100644
--- a/frontend/src/components/filters/FilterBar.tsx
+++ b/frontend/src/components/filters/FilterBar.tsx
@@ -32,24 +32,22 @@ export function FilterBar({
className,
}: FilterBarProps) {
const searchInputRef = useRef(null);
- const wasFocused = useRef(false);
- // Track if search input was focused before re-render
+ // Maintain focus on search input during re-renders
useEffect(() => {
const currentInput = searchInputRef.current;
if (!currentInput) return;
- // Check if the input was focused before the effect runs
- if (document.activeElement === currentInput) {
- wasFocused.current = true;
+ // Only restore focus if the search input had focus before
+ const wasFocused = document.activeElement === currentInput;
+
+ // Use requestAnimationFrame to restore focus after React finishes rendering
+ if (wasFocused && document.activeElement !== currentInput) {
+ requestAnimationFrame(() => {
+ currentInput.focus();
+ });
}
-
- // If it was focused, restore focus after render
- if (wasFocused.current && document.activeElement !== currentInput) {
- currentInput.focus();
- wasFocused.current = false;
- }
- });
+ }, [isSearchLoading]);
const hasActiveFilters =
filterState.searchTerm ||