Skip to content

Add filter negation feature#93909

Open
bernhardoj wants to merge 14 commits into
Expensify:mainfrom
bernhardoj:feat/93208-filter-negation
Open

Add filter negation feature#93909
bernhardoj wants to merge 14 commits into
Expensify:mainfrom
bernhardoj:feat/93208-filter-negation

Conversation

@bernhardoj

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #93208
PROPOSAL:

Tests

Same as QA Steps

  • Verify that no errors appear in the JS console

Offline tests

Same as QA Steps

QA Steps

  1. Go to Spend > Expenses
  2. Press the Filters button
  3. Open To, From, Currency, Purchase currency, Merchant, and "Exported to" filter
  4. Verify it has "Filter type" with "is" and "is not" options, and "is" is initially selected
  5. Open Has filter
  6. Verify it has "Filter type" with "has" and "doesn't have" options, and "has" is initially selected
  7. Apply any value and filter type to the filters
  8. If a positive filter type is applied (is/has), verify the filter chip/bar label is [filter name] is: [value]/Has: [value] (e.g., Merchant is: test, Has: Receipt)
  9. If a negative filter type is applied (is not/doesn't have), verify the filter chip/bar label is [filter name] is not: [value]/Doesn't have: [value] (e.g., Merchant is not: test, Doesn't have: Receipt)
  10. Close and reopen the filter
  11. Verify the filter value and type are still selected with the correct value
  12. Open the save search page
  13. Verify it has the same label as in the filter chip/bar

For steps 3-7, if you want more test steps, follow this:
No filter is applied yet

  1. Open any filter from the step above
  2. Verify the positive filter type is selected
  3. Change the filter type to negative
  4. Verify the filter is not applied yet (because no value is selected)
  5. Apply any value
  6. Verify that a negation filter is applied
  7. Change the filter type back to positive
  8. Verify that a positive filter is applied
  9. Unapply and reapply the value
  10. Verify that a positive filter is applied

For filter chip/bar:

  1. Press any applied filter chip/bar
  2. Verify that the filter value and type are selected with the correct value
  3. Play around with the test steps above
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4

@bernhardoj bernhardoj requested review from a team as code owners June 18, 2026 05:17
@melvin-bot

melvin-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@melvin-bot melvin-bot Bot requested review from DylanDylann and JmillsExpensify and removed request for a team June 18, 2026 05:18
@melvin-bot

melvin-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot removed the request for review from a team June 18, 2026 05:18
@bernhardoj

Copy link
Copy Markdown
Contributor Author

Can I run the translation script myself?

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5746a1607

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@bernhardoj

Copy link
Copy Markdown
Contributor Author

Btw, when we apply a negated HAS filter with a Tag value, it will be applied as "Tag: No tag".

w.mp4

It's from this code. It causes weird buggy behavior with the Has filter component, as shown in the video above.

if (hasNegatedTagFilter) {
filtersForm[FILTER_KEYS.TAG] = [CONST.SEARCH.TAG_EMPTY_VALUE];
}

Is that expected?

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @dubielzyk-expensify has triggered a test Expensify/App build. You can view the workflow run here.

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

This is looking great already @bernhardoj. Let's make this text label (13px) not body (15px)

CleanShot 2026-06-18 at 16 28 42@2x

@dubielzyk-expensify

dubielzyk-expensify commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

I'm not convinced we should use the is/is not in the chip itself:

CleanShot 2026-06-18 at 16 29 35@2x

I have to go and will have a noodle, but I think we might want an icon or do From: not Jon Dubby. But even that feels weird. I don't think it's crucial for it to be written fully out, but just be able to signal between is/isn't in some way, then when you open the filter you can see it more clearly there anyways

cc @Expensify/design @trjExpensify @JmillsExpensify

@bernhardoj

Copy link
Copy Markdown
Contributor Author

Let's make this text label (13px) not body (15px)

Done

@JS00001 JS00001 requested review from JS00001 and aimane-chnaif and removed request for DylanDylann June 18, 2026 12:12
@JmillsExpensify

Copy link
Copy Markdown
Contributor

I'm not convinced we should use the is/is not in the chip itself:

CleanShot 2026-06-18 at 16 29 35@2x I have to go and will have a noodle, but I think we might want an icon or do `From: not Jon Dubby`. But even that feels weird. I don't think it's crucial for it to be written fully out, but just be able to signal between is/isn't in some way, then when you open the filter you can see it more clearly there anyways

cc @Expensify/design @trjExpensify @JmillsExpensify

I'm fine with what I'm seeing in the adhoc.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

@bernhardoj Looks like we're still missing support for Status and Workspace in the adhoc. Those are mentioned in the OP. Let me know if I'm missing something!

CleanShot 2026-06-18 at 16 47 06@2x

@JS00001

JS00001 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Status and workspace are still having their BE PRs worked on: https://github.com/Expensify/Auth/pull/22241

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@bernhardoj

bernhardoj commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Updated filter label to use - prefix.

@JS00001 how is the BE going?

Also, can you help run the translation script?

@JS00001

JS00001 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

We've merged the first PR, waiting on another cc @c3024

@OSBotify

Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 12d27fb508c..3e8c5c6288f 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -8542,6 +8542,7 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: 'Bezahlen',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Export',
             },
+            filterType: {label: 'Filtertyp', has: {positive: 'hat', negative: 'hat nicht'}, is: {positive: 'ist', negative: 'ist nicht'}},
         },
         display: {
             label: 'Anzeige',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 2791a9678c9..2f9f9299682 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -8358,6 +8358,7 @@ ${amount} para ${merchant} - ${date}`,
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Exportar',
             },
             reportField: (name, value) => `${name} es ${value}`,
+            filterType: {label: 'Tipo de filtro', has: {positive: 'tiene', negative: 'no tiene'}, is: {positive: 'es', negative: 'no es'}},
         },
         chartTitles: {
             [CONST.SEARCH.GROUP_BY.FROM]: 'De',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index cffe9d13cca..2d3dcc17e2a 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -8576,6 +8576,7 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: 'Payer',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Exporter',
             },
+            filterType: {label: 'Type de filtre', has: {positive: 'a', negative: 'n’a pas'}, is: {positive: 'est', negative: 'n’est pas'}},
         },
         display: {
             label: 'Affichage',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 4d43c2004aa..96fc08e8326 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -8531,6 +8531,7 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: 'Paga',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Esporta',
             },
+            filterType: {label: 'Tipo di filtro', has: {positive: 'ha', negative: 'non ha'}, is: {positive: 'è', negative: 'non è'}},
         },
         display: {
             label: 'Visualizza',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index ae730f5c5f8..e89dc723301 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -8430,6 +8430,7 @@ ${reportName}`,
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: '支払う',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'エクスポート',
             },
+            filterType: {label: 'フィルタータイプ', has: {positive: '持っています', negative: '持っていません'}, is: {positive: 'は', negative: 'ではありません'}},
         },
         display: {
             label: '表示',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 273fdc657b3..2f238e038d4 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -8498,6 +8498,7 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: 'Betalen',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Exporteren',
             },
+            filterType: {label: 'Filtertype', has: {positive: 'heeft', negative: 'heeft niet'}, is: {positive: 'is', negative: 'is niet'}},
         },
         display: {
             label: 'Weergave',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index e7222b6076b..4a964fb4ea5 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -8491,6 +8491,7 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: 'Zapłać',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Eksportuj',
             },
+            filterType: {label: 'Typ filtra', has: {positive: 'ma', negative: 'nie ma'}, is: {positive: 'jest', negative: 'nie jest'}},
         },
         display: {
             label: 'Wyświetl',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 77235795833..41af9cb5dd3 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -8489,6 +8489,7 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: 'Pagar',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: 'Exportar',
             },
+            filterType: {label: 'Tipo de filtro', has: {positive: 'tem', negative: 'não tem'}, is: {positive: 'é', negative: 'não é'}},
         },
         display: {
             label: 'Exibir',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 0276d29afd7..92897194fb5 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -8260,6 +8260,7 @@ ${reportName}`,
                 [CONST.SEARCH.ACTION_FILTERS.PAY]: '支付',
                 [CONST.SEARCH.ACTION_FILTERS.EXPORT]: '导出',
             },
+            filterType: {label: '筛选类型', has: {positive: '有', negative: '没有'}, is: {positive: '是', negative: '不是'}},
         },
         display: {
             label: '显示',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@c3024

c3024 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@bernhardoj The backend PR required for this PR has been deployed. Could you please check whether the backend responses are as required for this PR?

@bernhardoj

Copy link
Copy Markdown
Contributor Author

@c3024 can you share how the BE would receive the query?

Currently, this is the query built from the parser of workspace:0142A68214A45343, filters and flatFilters are empty.

{
    "type": "expense",
    "status": "",
    "sortBy": "date",
    "sortOrder": "desc",
    "view": "table",
    "policyID": [
        "0142A68214A45343"
    ],
    "filters": null,
    "inputQuery": "workspace:0142A68214A45343",
    "flatFilters": [],
    "isViewExplicitlySet": false,
    "hash": 1260596085,
    "recentSearchHash": 1540228154,
    "similarSearchHash": 260806718
}

Compared to normal filters such as merchant, where the filters or flatFilters clearly defined the operator (eq or neq).

{
    "type": "expense",
    "status": "",
    "sortBy": "date",
    "sortOrder": "desc",
    "view": "table",
    "filters": {
        "operator": "neq",
        "left": "merchant",
        "right": "test"
    },
    "inputQuery": "type:expense sortBy:date sortOrder:desc -merchant:test",
    "flatFilters": [
        {
            "key": "merchant",
            "filters": [
                {
                    "operator": "neq",
                    "value": "test"
                }
            ]
        }
    ],
    "isViewExplicitlySet": false,
    "hash": 1455109608,
    "recentSearchHash": 814580803,
    "similarSearchHash": 1471278054,
    "rawFilterList": [
        {
            "key": "merchant",
            "operator": "neq",
            "value": "test",
            "isDefault": false
        }
    ]
}

If I enter -workspace:0142A68214A45343, it'll be treated as a keyword.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

@c3024

c3024 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@bernhardoj

TL;DR: A top-level field can't be negated. Negation (neq / "is not") only exists for leaves inside the filters AST. status and workspace have to move into the filters object so they can support "is not", just like merchant does today.


A couple of key things:

  • The BE uses policyID as status as the filter keys, not workspace. workspace is just the user-facing keyword and the parser already aliases it to policyID (see baseRules.peggy), so the leaf key sent to the BE should be policyID. status keeps its name.
  • The shape the BE expects looks just like the merchant example you posted, only with a different left:
{ "operator": "eq",  "left": "policyID", "right": "0142A68214A45343" }   // workspace:0142A68214A45343
{ "operator": "neq", "left": "policyID", "right": "0142A68214A45343" }   // -workspace:0142A68214A45343
{ "operator": "eq",  "left": "status",   "right": "drafts" }             // status:drafts
{ "operator": "neq", "left": "status",   "right": "drafts" }             // -status:drafts

So workspace/status need to end up in filters / flatFilters (with the operator), the same way merchant does, not as the top-level policyID: [...] / status fields, which are positive-only and have no operator to negate.

The reason it currently doesn't work is that in searchParser.peggy, status and policyID are listed under the defaultKey rule instead of the key rule. Default keys get written to the top-level fields and are then filtered out of the AST (filtersWithoutDefaults), which is why filters/flatFilters come back empty and why -workspace:... isn't recognized as a negatable filter (it falls through to a keyword). Moving them into the key rule should let them be parsed as proper filter leaves with eq/neq (neither is in nonNegatableKeys, so negation will work).

defaultFilter
= _ key:defaultKey _ op:operator _ value:identifier {
updateDefaultValues(key, value);
return {...buildFilter(op, key, value), isDefault: true};
}
freeTextFilter
= _ value:(quotedString / [^ \t\r\n\xA0]+) _ {
//handle no-breaking space
let word;
if (Array.isArray(value)) {
word = value.join("");
} else {
word = value;
}
return buildFilter("eq", "keyword", word);
}
standardFilter
= _ neg:"-"? field:filterKey _ op:filterOperator _ values:identifier {
expectingNestedQuote = false; nameOperator = false;
const key = field;
let operator = op;
// Apply negation only when "-" is present and the key can be negated
if (neg && !nonNegatableKeys.has(key)) {
if (operator === "eq") {
operator = "neq";
}
}
return buildFilter(operator, key, values);
}

So, searchParser.peggy should be modified so that policyID and status are moved inside filters object.

cc: @JS00001

@bernhardoj

Copy link
Copy Markdown
Contributor Author

Thanks for the clarification. I think I'll prepare a new PR for refactoring the policyID and status filter. I'm currently doing it, but I need another clarification. Filter like policyID is used for some filters, for example, exported to filters.

Exported to filter will show the options scoped to the selected policyID (workspace).

// When search is scoped to workspaces, use only those policies otherwise use all.
const policiesToUse = policyIDs !== undefined ? getAllPolicyValues(policyIDs, ONYXKEYS.COLLECTION.POLICY, policies) : Object.values(policies ?? {});

But when a user applies a negated policyID, should we "select" the non-selected policyID?

For example, we have policyID A, B, C, and D. The user applies a negated filter and chooses B. Should the exported to filter be scoped to policyID A, C, and D?

@JS00001 @JmillsExpensify

@bernhardoj

Copy link
Copy Markdown
Contributor Author

@c3024 also, maybe we should remove status from search snapshot data too?

image

@c3024

c3024 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

On the status in the snapshot, I think we should keep it for now. The frontend uses it to determine whether the search response that's loaded actually matches the search currently on screen.

App/src/libs/SearchUIUtils.ts

Lines 4688 to 4696 in 6f69123

function isSearchDataLoaded(searchResults: SearchResults | undefined, queryJSON: Readonly<SearchQueryJSON> | undefined) {
const {status} = queryJSON ?? {};
const sortedSearchResultStatus = !Array.isArray(searchResults?.search?.status)
? searchResults?.search?.status?.split(',').sort().join(',')
: searchResults?.search?.status?.sort().join(',');
const sortedQueryJSONStatus = Array.isArray(status) ? status.sort().join(',') : status;
const isDataLoaded =
(searchResults?.data != null || searchResults?.errors != null) && searchResults?.search?.type === queryJSON?.type && sortedSearchResultStatus === sortedQueryJSONStatus;

So the backend will keep sending status in the snapshot. But I just realized that for the negated case this field won't help: the backend only derives search.status from an eq status filter, so for -status:... it comes back empty, meaning it can't distinguish the response for a negated-status search.

Looking at that data-loaded logic more closely, status (with type) is only used as an identity check to confirm the snapshot belongs to the current query. A cleaner, fully general way to do that is to compare hashes: the snapshot is already keyed by the query hash, and the FE already sends hash to the backend on every Search request, so the backend can just echo it back in the snapshot's search payload, and the FE can compare searchResults.search.hash === queryJSON.hash. That covers negated status and every other filter, and it's always present (so no risk of an empty/missing value causing a stuck loading state).

So I think the path is:

  1. I'll spin up an Auth PR to include hash in the search snapshot so it can be used in the data-loaded check instead of status. Auth keeps sending status too for now, so production clients don't break.
  2. This App PR can update the data-loaded check to compare the hash from the Auth response instead of status.
  3. Once this FE PR is deployed to production, I'll remove status from the search snapshot along with the top-level jsonQuery status and policyID fields that Auth still temporarily accepts/sends anywhere.

What do you think @luacmartins and @JS00001 ?

@JS00001

JS00001 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

I think updating to use the hash to compare makes sense!

@bernhardoj

Copy link
Copy Markdown
Contributor Author

@JS00001 can you also check this comment, please

@JS00001

JS00001 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

For example, we have policyID A, B, C, and D. The user applies a negated filter and chooses B. Should the exported to filter be scoped to policyID A, C, and D?

Yeah I think we should select the correct policies that should be included

@bernhardoj

Copy link
Copy Markdown
Contributor Author

@JS00001 does QueueExportSearchToCSV and ExportSearchToCSV still require the query param? query param is basically a status filter. Asking to see if we can just remove it.

@JS00001

JS00001 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@bernhardoj where is 'query' passed? I dont see any reference to it in the BE, is it a part of the jsonQuery?

@bernhardoj

Copy link
Copy Markdown
Contributor Author

It's passed as a top-level param alongside jsonQuery.

App/src/libs/actions/Search.ts

Lines 1392 to 1406 in fb967fe

const finalParameters = enhanceParameters(WRITE_COMMANDS.QUEUE_EXPORT_SEARCH_ITEMS_TO_CSV, {
query,
jsonQuery,
reportIDList,
transactionIDList,
isBasicExport,
exportColumnLabels,
exportName,
exportID,
}) as QueueExportSearchItemsToCSVParams;
write(WRITE_COMMANDS.QUEUE_EXPORT_SEARCH_ITEMS_TO_CSV, finalParameters, {
optimisticData,
failureData,
});

App/src/libs/actions/Search.ts

Lines 1335 to 1364 in fb967fe

const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_SEARCH_ITEMS_TO_CSV, {
query,
jsonQuery,
reportIDList: Array.from(reportIDSet),
transactionIDList,
isBasicExport,
exportColumnLabels,
}) as Params;
const formData = new FormData();
for (const [key, value] of Object.entries(finalParameters)) {
if (Array.isArray(value)) {
formData.append(key, value.join(','));
} else {
formData.append(key, SafeString(value));
}
}
return fileDownload(
translate,
getCommandURL({command: WRITE_COMMANDS.EXPORT_SEARCH_ITEMS_TO_CSV}),
getExportFileName(exportName, rand64()),
'',
false,
formData,
CONST.NETWORK.METHOD.POST,
onDownloadFailed,
undefined,
false,
);

@JS00001

JS00001 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Hmm, yeah it looks like we just use jsonQuery, so we may not need query any more

@bernhardoj

Copy link
Copy Markdown
Contributor Author

Cool, thanks for the confirmation!

@JmillsExpensify

Copy link
Copy Markdown
Contributor

Let me know when we are ready for another round of adhoc product testing.

@bernhardoj

bernhardoj commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Opened a seperate PR (because it's quite big) to allow workspace and status to be negatable.

cc: @aimane-chnaif

Copy link
Copy Markdown
Contributor

Works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants