Skip to content

Commit 9e42bf8

Browse files
authored
Merge pull request #89563 from Expensify/claude-trimSearchInput
[CP Staging] Trim whitespace-only search input to prevent empty Ask Concierge messages
2 parents f1a4a92 + a0ac3ba commit 9e42bf8

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/components/Search/SearchPageHeader/useSearchPageInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function useSearchPageInput({queryJSON, onSearch, onSubmit}: UseSearchPageInputP
198198
}
199199
}
200200

201-
const searchQueryItems = textInputValue
201+
const searchQueryItems = textInputValue?.trim()
202202
? [
203203
{
204204
text: textInputValue,

src/components/Search/SearchRouter/SearchRouter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
200200
],
201201
);
202202

203-
const searchQueryItems = textInputValue
203+
const searchQueryItems = textInputValue?.trim()
204204
? [
205205
{
206206
text: textInputValue,

src/components/Search/SearchRouter/useAskConcierge.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ function useAskConcierge() {
2323

2424
return (searchQuery: string) => {
2525
openConciergeAnywhere();
26-
if (!targetReport || !targetReportID) {
26+
const trimmedQuery = searchQuery.trim();
27+
if (!trimmedQuery || !targetReport || !targetReportID) {
2728
return;
2829
}
2930
addComment({
3031
report: targetReport,
3132
notifyReportID: targetReportID,
3233
ancestors: [],
33-
text: searchQuery,
34+
text: trimmedQuery,
3435
timezoneParam: timezone ?? CONST.DEFAULT_TIME_ZONE,
3536
currentUserAccountID,
3637
shouldPlaySound: true,

0 commit comments

Comments
 (0)