[PR #6453] [WIP] fix: prevent crash when editing filter to 'one of' / 'not one of' #6536

Closed
opened 2026-02-28 21:29:43 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6453

State: closed
Merged: No


Summary

Fixes #6325

Problem

When editing an existing filter on the Notes field and changing the filter type to one of or not one of, the app crashes with:

TypeError: l.map is not a function Autocomplete.tsx:696

Root Cause

The MultiAutocomplete component expects selectedItems to be an array, but when switching filter types (e.g., from contains to one of), the previous value (a string) is passed instead.

Line 696:
sx const selectedItemIds = selectedItems.map(getItemId);

When selectedItems is a string, .map() fails.

Solution

Normalize selectedItems to always be an array before any array operations:

sx const normalizedItems = Array.isArray(selectedItems) ? selectedItems : []; const selectedItemIds = normalizedItems.map(getItemId);

Testing

  1. Open any account overview
  2. Create a filter on Notes using contains
  3. Apply the filter
  4. Edit the filter and change to one of
  5. App no longer crashes
**Original Pull Request:** https://github.com/actualbudget/actual/pull/6453 **State:** closed **Merged:** No --- ## Summary Fixes #6325 ## Problem When editing an existing filter on the Notes field and changing the filter type to `one of` or `not one of`, the app crashes with: ` TypeError: l.map is not a function Autocomplete.tsx:696 ` ## Root Cause The `MultiAutocomplete` component expects `selectedItems` to be an array, but when switching filter types (e.g., from `contains` to `one of`), the previous value (a string) is passed instead. Line 696: ` sx const selectedItemIds = selectedItems.map(getItemId); ` When `selectedItems` is a string, `.map()` fails. ## Solution Normalize `selectedItems` to always be an array before any array operations: ` sx const normalizedItems = Array.isArray(selectedItems) ? selectedItems : []; const selectedItemIds = normalizedItems.map(getItemId); ` ## Testing 1. Open any account overview 2. Create a filter on Notes using `contains` 3. Apply the filter 4. Edit the filter and change to `one of` 5. App no longer crashes
GiteaMirror added the pull-request label 2026-02-28 21:29:43 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6536