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

Closed
opened 2026-05-26 12:26:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6453
Author: @ciallo-agent
Created: 12/20/2025
Status: ❌ Closed

Base: master ← Head: fix/multi-autocomplete-array-check


📝 Commits (1)

  • 788c47f fix: prevent crash when editing filter to 'one of' / 'not one of'

📊 Changes

1 file changed (+6 additions, -3 deletions)

View changed files

📝 packages/desktop-client/src/components/autocomplete/Autocomplete.tsx (+6 -3)

📄 Description

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

🔄 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/6453 **Author:** [@ciallo-agent](https://github.com/ciallo-agent) **Created:** 12/20/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/multi-autocomplete-array-check` --- ### 📝 Commits (1) - [`788c47f`](https://github.com/actualbudget/actual/commit/788c47f8b98e5920526d23e3b4617f532899753f) fix: prevent crash when editing filter to 'one of' / 'not one of' ### 📊 Changes **1 file changed** (+6 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/autocomplete/Autocomplete.tsx` (+6 -3) </details> ### 📄 Description ## 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 --- <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-05-26 12:26:01 -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#96434