Skip to content

[$250] Spend - Hotel label missing for receipt-type:hotel filter #96724

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.4.42-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #96553
Email or phone of affected tester (no customers): sintayewhaylu01@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: web
App Component: Other

Action Performed:

  1. Navigate to https://staging.new.expensify.com.
  2. Go to the search bar and type receipt-type:.
  3. Verify that the autocomplete only suggests ereceipt and itemized.
  4. Type receipt-type:hotel and submit the search.
  5. Observe the filter list.

Expected Result:

The Hotel label is rendered in the filter list after manually entering receipt-type:hotel.

Actual Result:

No Hotel label is shown in the filter list after submitting receipt-type:hotel.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7214242_1784709173354.bandicam_2026-07-22_11-21-06-508.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7214242

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @allgandalf

Activity

  1. applause-bot commented on Jul 22, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/e7635b2f52161675a792a2dc8deb3e5fa97878ed1e44ff2bde3da8885515e5f0

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 22, 2026
  3. changed the title [-]spend -Hotel label missing for receipt-type:hotel filter[/-] [+]Spend - Hotel label missing for receipt-type:hotel filter[/+] on Jul 22, 2026
  4. MelvinBot commented on Jul 22, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    This is a regression from #96553 ("Hide hotel from the receipt type search filter"). That PR intended for a manually-typed receipt-type:hotel to still render its Hotel label (see its own test step 7), but it broke exactly that.

    The Receipt type filter's option list is built from SELECTABLE_RECEIPT_TYPES (ereceipt, itemized only), which no longer contains hotel:

    • SearchUIUtils.ts:5616-5620 — getMultiSelectFilterOptions now maps over SELECTABLE_RECEIPT_TYPES, so it emits no hotel option.
    • FilterComponents/index.tsx:74 — the multi-select derives its selected labels by intersecting the current value with those options: items.filter((item) => value.includes(item.value)). Since hotel isn't in items, an active hotel selection resolves to an empty label — nothing shows.

    The parse and query-chip paths are unaffected (hotel is still a valid parsed value at SearchQueryUtils.ts:1230-1236 and still translates via SearchUIUtils.ts:5476-5477), which is why the query still submits — only the filter selection list drops the label.

    What changes do you think we should make in order to solve the problem?

    Make the Receipt type option list hide hotel only as a new choice, while still surfacing it when it is already part of the current selection. In getMultiSelectFilterOptions, pass in the current filter value and, for RECEIPT_TYPE, build options from the union of SELECTABLE_RECEIPT_TYPES and any already-selected values (so hotel appears with its label when active, but isn't offered otherwise). This satisfies the original PR's intent (hidden from suggestions/picker, but its label still renders when applied).

    Alternative considered

    Reverting the option-list change would bring hotel back as a freely-selectable option, which contradicts the goal of #96553 (hotel has no backend data yet). The union approach keeps hotel un-selectable while preserving its label for manually-entered queries.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/96724) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 22, 2026
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 22, 2026
  7. David-2002065 commented on Jul 22, 2026

    @David-2002065
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-07-22 09:34:25 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    After manually typing receipt-type:hotel in the search bar and submitting, opening the Receipt type filter shows only eReceipt and Itemized — the applied Hotel value is not rendered as a selected item in the list, so there is no way to see or remove it.

    What is the root cause of that problem?

    PR #96553 hid hotel from the receipt-type picker by trimming the picker's option source to SELECTABLE_RECEIPT_TYPES (['ereceipt', 'itemized']). The problem is that this same option array is used to render the currently-selected rows, not just the values offered for a new selection.

    getMultiSelectFilterOptions now returns only the selectable types for RECEIPT_TYPE:

    App/src/libs/SearchUIUtils.ts

    Lines 5616 to 5620 in 908172c

    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
    return CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((receiptType) => {
    const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
    return {text: receiptTypeName, value: receiptType};
    });

    MultiSelectFilterComponents resolves the selected rows by filtering that same array, and MultiSelect builds its visible list exclusively from items (a value that isn't in items never becomes a row):

    function MultiSelectFilterComponents({filterKey, value = [], type = CONST.SEARCH.DATA_TYPES.EXPENSE, selectionListStyle, footer, onChange}: MultiSelectFilterComponentsProps) {
    const {translate} = useLocalize();
    const items = getMultiSelectFilterOptions(filterKey, type, translate);
    const multiSelectValues = items.filter((item) => (value as string[]).includes(item.value));
    return (
    <MultiSelect
    items={items}
    value={multiSelectValues}
    selectionListStyle={selectionListStyle}
    footer={footer}
    onChange={(selectedItems) => {
    onChange(selectedItems.map((item) => item.value));
    }}
    />
    );
    }

    const listData: ListItem[] = filteredItems.map((item) => ({
    text: item.text,
    keyForList: item.value,
    isSelected: !!selectedItems.find((i) => i.value === item.value),
    icons: item.icons,
    leftElement: item.leftElement,

    So a hand-typed receipt-type:hotel parses, validates and is stored in the form (hotel is still in the full CONST.SEARCH.RECEIPT_TYPE enum and in VALID_RECEIPT_TYPES), yet it has no row to render in the picker because it was removed from the options array. Notably the label path outside the picker still works — getDisplayValue labels the value directly through getReceiptTypeTranslationKey, which is why the results-header filter chip does show "Hotel":

    App/src/libs/SearchUIUtils.ts

    Lines 5476 to 5477 in 908172c

    if (key === FILTER_KEYS.RECEIPT_TYPE) {
    return form[key]?.map((receiptType) => translate(getReceiptTypeTranslationKey(receiptType))).join(', ');

    The regression is that PR #96553 conflated "values offered for a new selection" with "values rendered for the current selection". Hiding hotel from the former also hid it from the latter, which contradicts the PR's own stated intent that "typing receipt-type:hotel still parses, validates and renders its label".

    What changes do you think we should make in order to solve the problem?

    Keep hotel out of the pickable set, but let the picker also surface any value that is already applied — the offered options should be the selectable set unioned with the current selection.

    In getMultiSelectFilterOptions (src/libs/SearchUIUtils.ts), accept the current selection and, for RECEIPT_TYPE, offer the selectable types plus any already-selected value from the full enum:

    function getMultiSelectFilterOptions(filterKey: SearchAdvancedFiltersKey, type: SearchDataTypes, translate: LocalizedTranslate, selectedValues: string[] = []) {
        // ...
        if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
            const availableReceiptTypes = new Set<string>(CONST.SEARCH.SELECTABLE_RECEIPT_TYPES);
            // Keep any already-applied value (e.g. a hand-typed `receipt-type:hotel`) in the list so its label
            // renders and it can be deselected, without offering it for a fresh selection.
            selectedValues.forEach((value) => availableReceiptTypes.add(value));
            return Object.values(CONST.SEARCH.RECEIPT_TYPE)
                .filter((receiptType) => availableReceiptTypes.has(receiptType))
                .map((receiptType) => ({text: translate(getReceiptTypeTranslationKey(receiptType)), value: receiptType}));
        }
        // ...
    }

    Then pass the current value from MultiSelectFilterComponents (src/components/Search/FilterComponents/index.tsx):

    const items = getMultiSelectFilterOptions(filterKey, type, translate, value as string[]);

    Iterating Object.values(CONST.SEARCH.RECEIPT_TYPE) and filtering keeps the original enum ordering. When nothing is selected, the result is unchanged (eReceipt, Itemized only), so the picker and autocomplete stay clean for fresh selections; when receipt-type:hotel is applied, Hotel appears as a checked, labelled, removable row. Re-enabling hotel globally later is still just a revert of PR #96553.

    What specific test steps make sure that the issue is fixed?

    Extend getMultiSelectFilterOptions unit coverage (the PR only tested the no-selection case):

    • With no selection, getMultiSelectFilterOptions(RECEIPT_TYPE, ...) still excludes hotel.
    • With ['hotel'] passed as the current selection, the returned options include {value: 'hotel', text: 'Hotel'}, so the applied value renders and can be removed.

    What alternative solutions did you explore? (Optional)

    • Fix it purely inside MultiSelectFilterComponents by appending hidden-but-selected values with a local label lookup. It works, but it duplicates the receipt-type → label mapping outside getMultiSelectFilterOptions and would have to be repeated for every filter that hides values, so I prefer keeping the single source of truth.
    • Revert PR Hide hotel from the receipt type search filter #96553 so hotel is fully selectable again — this restores the label but re-introduces the empty-result selection the PR deliberately removed.
  8. MobileMage commented on Jul 22, 2026

    @MobileMage
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-07-22 09:30:15 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    hotel is a valid backend value for the receipt-type search filter, but after manually typing receipt-type:hotel in the search bar and submitting, the receipt-type filter selection list shows only eReceipt and Itemized — no "Hotel" row and no checked selection is rendered, even though the query keeps the hotel value. The applied filter becomes invisible in the filter UI.

    What is the root cause of that problem?

    The regression comes from PR #96553 (commit ee3a4da78a2, "Hide hotel from the receipt type filter options"). It introduced SELECTABLE_RECEIPT_TYPES = ['ereceipt', 'itemized'] and switched getMultiSelectFilterOptions for RECEIPT_TYPE from Object.values(CONST.SEARCH.RECEIPT_TYPE) (which includes hotel) to that reduced list. A sibling change did the same for the search-bar autocomplete via RECEIPT_TYPE_FRIENDLY_VALUES in useAutocompleteSuggestions.ts. The stated intent (see the comment on the constant) is that hotel can't return results until historical receipts are backfilled, so it should not be offered. The autocomplete-suggestion half (step 3 of the repro) is therefore working as designed.

    App/src/CONST/index.ts

    Lines 6706 to 6707 in 908172c

    // Hotel needs historical receipts backfilled with isHotelReservation before it can return results
    SELECTABLE_RECEIPT_TYPES: ['ereceipt', 'itemized'],

    The problem is that hotel is still fully valid and parseable everywhere else. VALID_RECEIPT_TYPES in SearchQueryUtils is built from all of CONST.SEARCH.RECEIPT_TYPE, so buildFilterFormValuesFromQuery keeps a manually typed receipt-type:hotel in the advanced-filters form, and getReceiptTypeTranslationKey('hotel') still resolves to search.receiptTypeValues.hotel = "Hotel". So the value survives into the form and has a valid label, but the receipt-type selection list no longer has an option row for it. getMultiSelectFilterOptions now emits only two rows:

    App/src/libs/SearchUIUtils.ts

    Lines 5616 to 5620 in 908172c

    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
    return CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((receiptType) => {
    const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
    return {text: receiptTypeName, value: receiptType};
    });

    The symptom is produced in MultiSelectFilterComponents, where items come from getMultiSelectFilterOptions (no hotel) and the selected set is derived by intersecting with those same items — items.filter((item) => value.includes(item.value)) — which is empty when value is ['hotel'].

    const items = getMultiSelectFilterOptions(filterKey, type, translate);
    const multiSelectValues = items.filter((item) => (value as string[]).includes(item.value));

    MultiSelect then builds its listData purely from items (items.map(... isSelected: !!selectedItems.find(...))), so any applied value that isn't in items has no row to render and no checkmark. The result is exactly the report: the Receipt type filter list shows eReceipt/Itemized unchecked and the applied Hotel value is silently dropped from view.

    What changes do you think we should make in order to solve the problem?

    Keep hotel out of new selection (autocomplete + default options), but still label it when it is already applied. The cleanest place is getMultiSelectFilterOptions: pass the current selected values in and, for RECEIPT_TYPE, union any applied-but-hidden valid value onto SELECTABLE_RECEIPT_TYPES before mapping to labels. It has a single production caller (MultiSelectFilterComponents), so widening the signature is safe.

    // getMultiSelectFilterOptions(filterKey, type, translate, selectedValues?: string[])
    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
        const visible = [...CONST.SEARCH.SELECTABLE_RECEIPT_TYPES];
        (selectedValues ?? []).forEach((v) => {
            if (!visible.includes(v) && VALID_RECEIPT_TYPES.has(v)) visible.push(v);
        });
        return visible.map((receiptType) => ({text: translate(getReceiptTypeTranslationKey(receiptType)), value: receiptType}));
    }

    Then call it with the current value in MultiSelectFilterComponents: getMultiSelectFilterOptions(filterKey, type, translate, value as string[]). This makes the "Hotel" row appear (checked) only because it was already in the query, so it renders and can be de-selected, while a fresh filter still never offers hotel. Autocomplete stays untouched, so step 3 of the repro remains correct.

    What alternative solutions did you explore? (Optional)

    Reverting getMultiSelectFilterOptions back to Object.values(CONST.SEARCH.RECEIPT_TYPE) and hiding hotel only in the autocomplete would fix the label, but it re-exposes hotel as a freely selectable option in the RHP filter list — precisely what PR #96553 set out to prevent — so it's the wrong trade-off.

  9. yusufdeveloper2903 commented on Jul 22, 2026

    @yusufdeveloper2903
    Contributor

    Proposal

    What is the root cause of that problem?

    When a user manually types receipt-type:hotel into the search bar and submits, the hotel value is parsed correctly by the search query parser. However, when the filter is rendered in the filter list above the results, the backend value (hotel) is never translated to its display text (e.g., "Hotel"). This happens because getFilterDisplayValue() in SearchQueryUtils.ts is missing a case for RECEIPT_TYPE, while the same function handles all other comparable filters like EXPENSE_TYPE, WITHDRAWAL_TYPE, PAID_STATUS, WITHDRAWAL_STATUS, etc.

    The autocomplete suggestions for receipt-type: work correctly because they pull from CONST.SEARCH.RECEIPT_TYPE and explicitly call getReceiptTypeTranslationKey() to translate each backend value to display text. But once a value is manually entered and the search query is parsed, the display rendering path in getFilterDisplayValue() lacks the corresponding receipt-type translation logic.

    The causal chain:

    1. User types receipt-type:hotel into search bar
    2. Search parser validates and accepts the filter (hotel is in CONST.SEARCH.RECEIPT_TYPE)
    3. Search executes and populates results
    4. When rendering the filter chip/label above results, the code calls getFilterDisplayValue() with filterName=receiptType and filterValue=hotel
    5. getFilterDisplayValue() reaches line 1652 (the final return filterValue) without matching any case, so it returns the raw backend value hotel instead of the translated display text

    function getFilterDisplayValue({
    filterName,
    filterValue,
    personalDetails,
    reports,
    cardList,
    cardFeeds,
    policies,
    currentUserAccountID,
    translate,
    reportAttributes,
    feedKeysWithCards,
    bankAccountList,
    }: GetFilterDisplayValueParams) {
    if (
    filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM ||
    filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TO ||
    filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.ASSIGNEE ||
    filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.PAYER ||
    filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTER ||
    filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.ATTENDEE
    ) {
    if (filterValue === CONST.SEARCH.ME) {
    return CONST.SEARCH.ME;
    }
    return filterValue === currentUserAccountID.toString()
    ? CONST.SEARCH.ME
    : temporaryGetDisplayNameOrDefault({passedPersonalDetails: personalDetails?.[filterValue], defaultValue: filterValue, shouldFallbackToHidden: false, translate});
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID) {
    const cardID = parseInt(filterValue, 10);
    if (Number.isNaN(cardID)) {
    return filterValue;
    }
    return getCardDescription(cardList?.[cardID], translate) || filterValue;
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.BANK_ACCOUNT) {
    const bankAccount = bankAccountList?.[filterValue];
    if (!bankAccount) {
    return filterValue;
    }
    return getBankAccountSearchLabel(bankAccount);
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.IN) {
    return getReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${filterValue}`], reportAttributes) || filterValue;
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.AMOUNT || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TOTAL || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.PURCHASE_AMOUNT) {
    // Added 2 here as this is the maximum number of decimals an amount can have. So, we can run a search with 2 decimals here.
    const frontendAmount = convertToFrontendAmountAsInteger(Number(filterValue), 2);
    return Number.isNaN(frontendAmount) ? filterValue : frontendAmount.toString();
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG) {
    return getCleanedTagName(filterValue);
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.FEED) {
    const cardFeedsForDisplay = getCardFeedsForDisplay(cardFeeds, cardList, translate, feedKeysWithCards);
    return cardFeedsForDisplay[filterValue]?.name ?? filterValue;
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID) {
    return getPolicyNameWithFallback(filterValue, policies, reports);
    }
    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO) {
    if (filterValue === CONST.REPORT.EXPORT_OPTIONS.REPORT_LEVEL_EXPORT) {
    return CONST.REPORT.EXPORT_OPTION_LABELS.REPORT_LEVEL_EXPORT;
    }
    if (filterValue === CONST.REPORT.EXPORT_OPTIONS.EXPENSE_LEVEL_EXPORT) {
    return CONST.REPORT.EXPORT_OPTION_LABELS.EXPENSE_LEVEL_EXPORT;
    }
    return filterValue;
    }
    return filterValue;
    }

    Compare with RECEIPT_TYPE already being handled correctly in buildFilterFormValuesFromQuery() at line 1230, which validates receipt type values:

    if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.RECEIPT_TYPE) {
    const receiptTypeValues = filterValues.filter((receiptType): receiptType is ReceiptTypeValue => VALID_RECEIPT_TYPES.has(receiptType));
    if (isNegated) {
    filtersForm[FILTER_KEYS.RECEIPT_TYPE_NOT] = receiptTypeValues;
    } else {
    filtersForm[FILTER_KEYS.RECEIPT_TYPE] = receiptTypeValues;
    }
    }

    And the display translation for receipt types is already proven to work in SearchUIUtils.ts for the advanced filters UI:

    App/src/libs/SearchUIUtils.ts

    Lines 5612 to 5617 in fd467ee

    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
    return Object.values(CONST.SEARCH.RECEIPT_TYPE).map((receiptType) => {
    const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
    return {text: receiptTypeName, value: receiptType};
    });
    }

    The missing piece is exactly the case in getFilterDisplayValue(). The function getReceiptTypeTranslationKey() is already defined and ready to use:

    function getReceiptTypeTranslationKey(receiptType: ValueOf<typeof CONST.SEARCH.RECEIPT_TYPE>): TranslationPaths {
    // eslint-disable-next-line default-case
    switch (receiptType) {
    case CONST.SEARCH.RECEIPT_TYPE.ERECEIPT:
    return 'search.receiptTypeValues.ereceipt';
    case CONST.SEARCH.RECEIPT_TYPE.ITEMIZED:
    return 'search.receiptTypeValues.itemized';
    case CONST.SEARCH.RECEIPT_TYPE.HOTEL:
    return 'search.receiptTypeValues.hotel';
    }

    What changes do you think we should make in order to solve the problem?

    Add a case for RECEIPT_TYPE in getFilterDisplayValue() that translates backend values using getReceiptTypeTranslationKey().

    1. Update getFilterDisplayValue() function — Add the receipt-type case right before the final return statement, using the same pattern as CARD_ID and BANK_ACCOUNT:

    if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.RECEIPT_TYPE) {
        return translate(getReceiptTypeTranslationKey(filterValue as ValueOf<typeof CONST.SEARCH.RECEIPT_TYPE>));
    }

    Insert this after line 1651 (after the EXPORTED_TO case) and before line 1652 (the final return).

    Why this is safe:

    • The getReceiptTypeTranslationKey() function already safely handles all three receipt type backend values (ereceipt, itemized, hotel), returning the correct translation path for each. See src/libs/TransactionUtils/index.ts, lines 218-225.
    • The filter value is guaranteed to be one of CONST.SEARCH.RECEIPT_TYPE because the search parser only accepts valid values.
    • This mirrors the existing pattern used for other similar enum-like filters (CARD_ID, BANK_ACCOUNT, POLICY_ID, etc.), so it carries zero risk of introducing a new pattern.
    • The validation already happens at parse-time in buildFilterFormValuesFromQuery() at line 1231 of SearchQueryUtils.ts, so an invalid receipt type never reaches the display layer anyway.

    Result: When a user manually enters receipt-type:hotel and submits, the filter chip will now display "Hotel" (the translated value) instead of the raw backend value "hotel", matching the autocomplete suggestions and fixing both the missing label and the search consistency.

    What alternative solutions did you explore? (Optional)

    • Use getUserFriendlyValue() instead: This would require adding hotel to the SEARCH_USER_FRIENDLY_VALUES_MAP. However, the dedicated getReceiptTypeTranslationKey() function already exists and is purpose-built for this, so adding a new map entry would duplicate logic.
    • Translate at parse-time in buildFilterFormValuesFromQuery(): Would work, but that function is already complex and handles 20+ filter types; the display layer is the correct place for this transformation, and it's consistent with how the codebase handles other enum filters.
  10. abbasifaizan70 commented on Jul 22, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user manually types receipt-type:hotel into the search bar and submits it, the "Hotel" label/chip does not appear anywhere in the resulting filter list (e.g. in the Advanced Filters "Receipt type" picker), even though hotel is a valid, recognized receipt type value.

    What is the root cause of that problem?

    CONST.SEARCH.SELECTABLE_RECEIPT_TYPES intentionally only contains ereceipt and itemized (hotel receipts aren't backfilled with search data yet), and this same constant is reused to build the list of selectable options shown in the Receipt Type filter picker:

    App/src/CONST/index.ts

    Lines 6706 to 6707 in 3e8642c

    // Hotel needs historical receipts backfilled with isHotelReservation before it can return results
    SELECTABLE_RECEIPT_TYPES: ['ereceipt', 'itemized'],

    getMultiSelectFilterOptions builds the Receipt Type picker's items strictly from that restricted list, so hotel is never one of the generated items:

    App/src/libs/SearchUIUtils.ts

    Lines 5616 to 5621 in 3e8642c

    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
    return CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((receiptType) => {
    const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
    return {text: receiptTypeName, value: receiptType};
    });
    }

    MultiSelectFilterComponents then determines which items are "selected" by intersecting the form's value (which does contain 'hotel', since VALID_RECEIPT_TYPES in SearchQueryUtils.ts is built from the full CONST.SEARCH.RECEIPT_TYPE enum and correctly keeps it in the form) against items. Because items never contains a hotel entry, Array.prototype.filter finds no match and nothing is rendered for it:

    function MultiSelectFilterComponents({filterKey, value = [], type = CONST.SEARCH.DATA_TYPES.EXPENSE, selectionListStyle, footer, onChange}: MultiSelectFilterComponentsProps) {
    const {translate} = useLocalize();
    const items = getMultiSelectFilterOptions(filterKey, type, translate);
    const multiSelectValues = items.filter((item) => (value as string[]).includes(item.value));
    return (
    <MultiSelect
    items={items}
    value={multiSelectValues}
    selectionListStyle={selectionListStyle}
    footer={footer}
    onChange={(selectedItems) => {
    onChange(selectedItems.map((item) => item.value));
    }}
    />
    );
    }

    So the value survives all the way into the form/query (it's a legitimate receipt type), but the picker UI silently drops it from display because it only knows about the "suggestable" subset of receipt types, not the full set of valid ones. This is purely a display bug in how selected-but-not-suggested values are reconciled with the options list — it's unrelated to the (intentional) exclusion of hotel from autocomplete suggestions.

    What changes do you think we should make in order to solve the problem?

    Keep hotel out of the suggested autocomplete/options list (that exclusion is intentional per the code comment), but make sure a value that is already selected/applied is still included as an item so it can render with its translated label. The cleanest way is to have getMultiSelectFilterOptions accept the currently selected values and union them into the generated items for the RECEIPT_TYPE case, instead of hard-limiting to SELECTABLE_RECEIPT_TYPES.

    Original code to change:

    App/src/libs/SearchUIUtils.ts

    Lines 5600 to 5621 in 3e8642c

    function getMultiSelectFilterOptions(filterKey: SearchAdvancedFiltersKey, type: SearchDataTypes, translate: LocalizedTranslate) {
    if (filterKey === FILTER_KEYS.HAS) {
    return getHasOptions(translate, type);
    }
    if (filterKey === FILTER_KEYS.IS) {
    return Object.values(CONST.SEARCH.IS_VALUES).map((value) => ({text: translate(`common.${value}`), value}));
    }
    if (filterKey === FILTER_KEYS.EXPENSE_TYPE) {
    return Object.values(CONST.SEARCH.TRANSACTION_TYPE).map((expenseType) => {
    const expenseTypeName = translate(getExpenseTypeTranslationKey(expenseType));
    return {text: expenseTypeName, value: expenseType};
    });
    }
    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
    return CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((receiptType) => {
    const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
    return {text: receiptTypeName, value: receiptType};
    });
    }

    function MultiSelectFilterComponents({filterKey, value = [], type = CONST.SEARCH.DATA_TYPES.EXPENSE, selectionListStyle, footer, onChange}: MultiSelectFilterComponentsProps) {
    const {translate} = useLocalize();
    const items = getMultiSelectFilterOptions(filterKey, type, translate);
    const multiSelectValues = items.filter((item) => (value as string[]).includes(item.value));
    return (
    <MultiSelect
    items={items}
    value={multiSelectValues}
    selectionListStyle={selectionListStyle}
    footer={footer}
    onChange={(selectedItems) => {
    onChange(selectedItems.map((item) => item.value));
    }}
    />
    );
    }

    1. Add an optional selectedValues parameter to getMultiSelectFilterOptions, and for the RECEIPT_TYPE branch, build the options list from the union of CONST.SEARCH.SELECTABLE_RECEIPT_TYPES and any already-selected values that are valid entries of CONST.SEARCH.RECEIPT_TYPE (so a manually-typed hotel still resolves to an item with its translated label), while all other filter keys keep their current behavior untouched:
    function getMultiSelectFilterOptions(filterKey: SearchAdvancedFiltersKey, type: SearchDataTypes, translate: LocalizedTranslate, selectedValues: string[] = []) {
        if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
            const validReceiptTypes = new Set<string>(Object.values(CONST.SEARCH.RECEIPT_TYPE));
            const receiptTypesToDisplay = [...new Set([...CONST.SEARCH.SELECTABLE_RECEIPT_TYPES, ...selectedValues.filter((value) => validReceiptTypes.has(value))])];
            return receiptTypesToDisplay.map((receiptType) => {
                const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType as ReceiptTypeValue));
                return {text: receiptTypeName, value: receiptType};
            });
        }
    1. Update the single call site to pass the current value through so already-applied values are preserved in the options list:
        const items = getMultiSelectFilterOptions(filterKey, type, translate, value as string[]);

    With this change, typing receipt-type:hotel and submitting will still keep hotel out of the autocomplete suggestions (unchanged, since useAutocompleteSuggestions.ts reads CONST.SEARCH.SELECTABLE_RECEIPT_TYPES directly), but the Receipt Type filter list/picker will correctly render the "Hotel" chip using the existing search.receiptTypeValues.hotel translation, since getReceiptTypeTranslationKey already supports CONST.SEARCH.RECEIPT_TYPE.HOTEL.

  11. ahmdshrif commented on Jul 22, 2026

    @ahmdshrif
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-07-22 09:30:31 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    receipt-type:hotel is still a valid, parseable filter value, but after manually typing and submitting it, the "Hotel" label never appears in the receipt-type filter list — and interacting with that filter silently deletes receipt-type:hotel from the query.

    What is the root cause of that problem?

    This is a regression from PR #96553 ("Hide hotel from the receipt type search filter"). Its intent was to hide hotel from the suggestions (backend has no isHotelReservation data backfilled yet), and its description explicitly assumed "Typing receipt-type:hotel still parses, validates and renders its label". That assumption is wrong, because the PR restricted the wrong layer:

    1. The PR added SELECTABLE_RECEIPT_TYPES: ['ereceipt', 'itemized']:

      App/src/CONST/index.ts

      Lines 6701 to 6707 in 908172c

      RECEIPT_TYPE: {
      ERECEIPT: 'ereceipt',
      ITEMIZED: 'itemized',
      HOTEL: 'hotel',
      },
      // Hotel needs historical receipts backfilled with isHotelReservation before it can return results
      SELECTABLE_RECEIPT_TYPES: ['ereceipt', 'itemized'],
    2. A typed receipt-type:hotel survives every data step. The search parser keeps it (I ran it: {"left":"receiptType","right":"hotel"}), form validation accepts it against the full enum (VALID_RECEIPT_TYPES):
      const VALID_RECEIPT_TYPES = new Set<string>(Object.values(CONST.SEARCH.RECEIPT_TYPE));
      and it lands in the filters form:
      if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.RECEIPT_TYPE) {
      const receiptTypeValues = filterValues.filter((receiptType): receiptType is ReceiptTypeValue => VALID_RECEIPT_TYPES.has(receiptType));
      if (isNegated) {
      filtersForm[FILTER_KEYS.RECEIPT_TYPE_NOT] = receiptTypeValues;
      } else {
      filtersForm[FILTER_KEYS.RECEIPT_TYPE] = receiptTypeValues;
      }
      }
    3. But getMultiSelectFilterOptions() now enumerates only SELECTABLE_RECEIPT_TYPES:

      App/src/libs/SearchUIUtils.ts

      Lines 5616 to 5621 in 908172c

      if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
      return CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((receiptType) => {
      const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
      return {text: receiptTypeName, value: receiptType};
      });
      }
    4. The structural cause: that function is not just the "suggestion" source — it is the single source of truth every receipt-type selection UI uses to render applied values. MultiSelectFilterComponents resolves the applied form value against those items, so hotel matches nothing and renders nowhere:
      function MultiSelectFilterComponents({filterKey, value = [], type = CONST.SEARCH.DATA_TYPES.EXPENSE, selectionListStyle, footer, onChange}: MultiSelectFilterComponentsProps) {
      const {translate} = useLocalize();
      const items = getMultiSelectFilterOptions(filterKey, type, translate);
      const multiSelectValues = items.filter((item) => (value as string[]).includes(item.value));
      return (
      <MultiSelect
      items={items}
      value={multiSelectValues}
      selectionListStyle={selectionListStyle}
      footer={footer}
      onChange={(selectedItems) => {
      onChange(selectedItems.map((item) => item.value));
      }}
      />
      );
      }
      (line 74: items.filter((item) => value.includes(item.value)) → []).
    5. Worse — silent data loss: the same component's onChange re-emits only checked listed items (lines 82–84), so opening the Receipt type filter and applying wipes receipt-type:hotel from the user's query without any user action on hotel.

    Affected paths (all funnel into FilterComponents → getMultiSelectFilterOptions):

    This explains every symptom: autocomplete no longer suggests hotel (intended, useAutocompleteSuggestions.ts#L75), the Hotel entry/label is missing from the filter list on both web and Android, and the label loss only exists on staging (production still has the pre-#96553 full option list; the backend is shared, so only this App change can explain the staging-only repro).

    What changes do you think we should make in order to solve the problem?

    Fix at the convergence point: teach getMultiSelectFilterOptions to include applied-but-unselectable values, so a manually-entered hotel filter renders (and survives apply) while hotel stays hidden whenever it is not already in the query:

    function getMultiSelectFilterOptions(filterKey, type, translate, selectedValues: string[] = []) {
        ...
        if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
            const applied = selectedValues.filter((v): v is ReceiptTypeValue => VALID_RECEIPT_TYPES.has(v) && !CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.includes(v));
            return [...CONST.SEARCH.SELECTABLE_RECEIPT_TYPES, ...applied].map((receiptType) => ({text: translate(getReceiptTypeTranslationKey(receiptType)), value: receiptType}));
        }

    and pass the applied value at the only call site (FilterComponents/index.tsx#L73): getMultiSelectFilterOptions(filterKey, type, translate, value as string[]). getReceiptTypeTranslationKey already maps hotel → search.receiptTypeValues.hotel ("Hotel"), so no copy changes are needed:

    function getReceiptTypeTranslationKey(receiptType: ValueOf<typeof CONST.SEARCH.RECEIPT_TYPE>): TranslationPaths {
    // eslint-disable-next-line default-case
    switch (receiptType) {
    case CONST.SEARCH.RECEIPT_TYPE.ERECEIPT:
    return 'search.receiptTypeValues.ereceipt';
    case CONST.SEARCH.RECEIPT_TYPE.ITEMIZED:
    return 'search.receiptTypeValues.itemized';
    case CONST.SEARCH.RECEIPT_TYPE.HOTEL:
    return 'search.receiptTypeValues.hotel';
    }
    }
    . Also update the unit test PR #96553 added in tests/unit/Search/SearchUIUtilsTest.ts (L11239) to cover the applied-hotel case. Regression safety: the new parameter is optional and empty in every no-selection render, so the picker, autocomplete, and all other multi-select filters behave exactly as today.

    Why the simple fix fails: reverting the getMultiSelectFilterOptions hunk (or re-adding hotel to SELECTABLE_RECEIPT_TYPES) re-exposes Hotel as a suggestible/pickable option — exactly what #96553 intentionally removed until the backend backfill lands. And a display-only patch (special-casing the pill/label text) still leaves the popup's onChange emitting only listed values, so applying the Receipt type filter would keep silently deleting receipt-type:hotel from the query.

    What alternative solutions did you explore? (Optional)

    • Revert #96553's SearchUIUtils hunk — restores the label but re-lists Hotel as pickable, defeating the PR's intent (see above).
    • Merge unmatched values into items inside MultiSelectFilterComponents — same behavior, but that component lacks per-filter-key translation knowledge; the mapping belongs in getMultiSelectFilterOptions, which already has translate and the key.
  12. mukhrr commented on Jul 22, 2026

    @mukhrr
    Contributor

    Proposal

    What is the root cause of that problem?

    I found that hotel remains a valid receipt type, and manually entered queries are parsed into the receiptType filter correctly:

    if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.RECEIPT_TYPE) {
    const receiptTypeValues = filterValues.filter((receiptType): receiptType is ReceiptTypeValue => VALID_RECEIPT_TYPES.has(receiptType));
    if (isNegated) {
    filtersForm[FILTER_KEYS.RECEIPT_TYPE_NOT] = receiptTypeValues;
    } else {
    filtersForm[FILTER_KEYS.RECEIPT_TYPE] = receiptTypeValues;
    }

    The regression was introduced when the receipt-type options were changed from all valid values to SELECTABLE_RECEIPT_TYPES so Hotel would not be suggested before historical receipts are backfilled:

    App/src/libs/SearchUIUtils.ts

    Lines 5622 to 5626 in ee3a4da

    if (filterKey === FILTER_KEYS.RECEIPT_TYPE) {
    return CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((receiptType) => {
    const receiptTypeName = translate(getReceiptTypeTranslationKey(receiptType));
    return {text: receiptTypeName, value: receiptType};
    });

    That selectable list intentionally excludes hotel:

    App/src/CONST/index.ts

    Lines 6701 to 6707 in 908172c

    RECEIPT_TYPE: {
    ERECEIPT: 'ereceipt',
    ITEMIZED: 'itemized',
    HOTEL: 'hotel',
    },
    // Hotel needs historical receipts backfilled with isHotelReservation before it can return results
    SELECTABLE_RECEIPT_TYPES: ['ereceipt', 'itemized'],

    However, MultiSelectFilterComponents also uses those selectable options to resolve the current filter value. It filters value against items, so a manually entered hotel value has no matching item and becomes an empty selection:

    function MultiSelectFilterComponents({filterKey, value = [], type = CONST.SEARCH.DATA_TYPES.EXPENSE, selectionListStyle, footer, onChange}: MultiSelectFilterComponentsProps) {
    const {translate} = useLocalize();
    const items = getMultiSelectFilterOptions(filterKey, type, translate);
    const multiSelectValues = items.filter((item) => (value as string[]).includes(item.value));
    return (
    <MultiSelect
    items={items}
    value={multiSelectValues}
    selectionListStyle={selectionListStyle}

    MultiSelect can only render rows from items, which is why the selected Hotel label disappears:

    const initialSelectedValues = useInitialValue(() => value.map((item) => item.value));
    const orderedItems = moveInitialSelectionToTop(items, initialSelectedValues);
    const searchLower = debouncedSearchTerm.toLowerCase();
    const filteredItems = isSearchable
    ? orderedItems.filter((item) => item.text.toLowerCase().includes(searchLower) || item.searchableText?.toLowerCase().includes(searchLower))
    : orderedItems;
    const listData: ListItem[] = filteredItems.map((item) => ({
    text: item.text,
    keyForList: item.value,
    isSelected: !!selectedItems.find((i) => i.value === item.value),
    icons: item.icons,
    leftElement: item.leftElement,
    }));

    What changes do you think we should make in order to solve the problem?

    I think we should update getMultiSelectFilterOptions() to accept the current values and, for RECEIPT_TYPE, append any valid currently selected receipt types that are absent from SELECTABLE_RECEIPT_TYPES. MultiSelectFilterComponents should pass its current value into that function.

    For example:

    - const items = getMultiSelectFilterOptions(filterKey, type, translate);
    + const items = getMultiSelectFilterOptions(filterKey, type, translate, value);

    The receipt-type branch would build options from the union of SELECTABLE_RECEIPT_TYPES and valid selected values. Therefore, hotel appears as a selected Hotel row only when it came from the existing query, while an empty receipt-type filter continues to offer only eReceipt and Itemized.

    I would add tests covering both cases:

    • No current value still excludes Hotel.
    • A current hotel value returns and renders the translated Hotel option.

    This does not regress autocomplete because it continues to use SELECTABLE_RECEIPT_TYPES directly:

    // Static autocomplete lists derived from CONST values, computed once at module load
    const DATA_TYPE_VALUES = Object.values(CONST.SEARCH.DATA_TYPES);
    const GROUP_BY_FRIENDLY_VALUES = Object.values(CONST.SEARCH.GROUP_BY).map((value) => getUserFriendlyValue(value));
    const VIEW_FRIENDLY_VALUES = Object.values(CONST.SEARCH.VIEW).map((value) => getUserFriendlyValue(value));
    const EXPENSE_TYPE_FRIENDLY_VALUES = Object.values(CONST.SEARCH.TRANSACTION_TYPE).map((value) => getUserFriendlyValue(value));
    const RECEIPT_TYPE_FRIENDLY_VALUES = CONST.SEARCH.SELECTABLE_RECEIPT_TYPES.map((value) => getUserFriendlyValue(value));
    const WITHDRAWAL_TYPE_VALUES = Object.values(CONST.SEARCH.WITHDRAWAL_TYPE);

    Other multi-select filters are unaffected because the selected-value augmentation is limited to RECEIPT_TYPE.

    What alternative solutions did you explore? (Optional)

    I considered restoring Object.values(CONST.SEARCH.RECEIPT_TYPE) unconditionally, but that would undo the intentional change and make Hotel selectable again for new searches. Preserving it only when already present in the query fixes the missing label without reintroducing that behavior.

  13. lorretheboy commented on Jul 22, 2026

    @lorretheboy
    Contributor

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  14. 14 remaining items

  15. github-actions commented on Jul 22, 2026

    @github-actions
    Contributor

    ⚠️ @KJ21-ENG Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  16. github-actions commented on Jul 22, 2026

    @github-actions
    Contributor

    ⚠️ @marufsharifi Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  17. KJ21-ENG commented on Jul 22, 2026

    @KJ21-ENG
    Contributor

    Updated my proposal.

    What changed: Added cross-layout call-site proof and mixed-selection lifecycle coverage while preserving the active-only Hotel option fix.

    Why: The existing body was duplicate-flagged, while its wider layout and state-transition coverage was not explicit enough.

  18. askavyblr commented on Jul 22, 2026

    @askavyblr

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  19. github-actions commented on Jul 22, 2026

    @github-actions
    Contributor

    ⚠️ @askavyblr Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  20. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 22, 2026
  21. yuwenmemon commented on Jul 22, 2026

    @yuwenmemon
    Contributor

    @JS00001 @allgandalf This came from: #96553

  22. bernhardoj commented on Jul 23, 2026

    @bernhardoj
    Contributor

    @allgandalf are you going to handle this as a follow-up?

  23. allgandalf commented on Jul 23, 2026

    @allgandalf
    Contributor

    We hit it on purpose for now ,

    Image

    The QA steps say the same, i'm closing this out, please reopen if i'm mistaken

  24. SupremeDreamZ commented on Jul 25, 2026

    @SupremeDreamZ

    Proposal

    Root cause confirmed: PR #96553 removed hotel from SELECTABLE_RECEIPT_TYPES (autocomplete/default options), but getMultiSelectFilterOptions() builds its option list only from that array. When a user manually types receipt-type:hotel, the value passes validation in SearchQueryUtils (VALID_RECEIPT_TYPES still includes it) but has no display entry → blank chip.

    Fix (PR #97037):

    • getMultiSelectFilterOptions(): for RECEIPT_TYPE, return union of SELECTABLE_RECEIPT_TYPES + any currently-applied values (currentValues param). Already-selected receipt types always resolve a label.
    • MultiSelectFilterComponents: pass value array to the option builder.
    • SELECTABLE_RECEIPT_TYPES unchanged → hotel stays hidden from fresh autocomplete exactly as Hide hotel from the receipt type search filter #96553 intended.

    Tests proving it works (tests/unit/Search/SearchUIUtilsTest.ts):

    Current value Before (blank) After (label renders)
    [] [ereceipt, itemized] ✅ [ereceipt, itemized] ✅
    [hotel] [] ❌ [ereceipt, itemized, hotel] ✅
    [ereceipt, hotel] [ereceipt] ❌ [ereceipt, itemized, hotel] ✅
    [itemized, hotel] [itemized] ❌ [ereceipt, itemized, hotel] ✅

    All 4 cases pass bun test --test-name-pattern="getMultiSelectFilterOptions".

    Why this PR over the 6 existing proposals

    All 6 identify the same root cause. This is the only one that:

    1. Ships passing unit tests covering the exact regression + edge cases
    2. Minimal surface change — optional currentValues?: string[] param, zero call-site breaks
    3. Single source of truth — autocomplete still controlled by SELECTABLE_RECEIPT_TYPES; label resolution is additive
    4. Zero behavior regression — hotel remains hidden from new selections

    Ready for review — happy to address feedback fast.

  25. melvin-bot commented on Jul 25, 2026

    @melvin-bot

    📣 @SupremeDreamZ! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions