@zeniai/client-epic-state 4.19.84-betaVR4 → 4.19.84-betaVR6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,12 +16,17 @@ export const MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
16
16
  export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
17
17
  const searchActions$ = actions$.pipe(filter(searchTransactionsForManualMatch.match));
18
18
  const pagination$ = searchActions$.pipe(filter((a) => a.payload.pageToken != null));
19
- /** Clears: no debounce so switchMap cancels in-flight HTTP from the previous query immediately. */
20
- const newSearchClear$ = searchActions$.pipe(filter((a) => a.payload.pageToken == null && a.payload.query.trim() === ''));
21
- const newSearchDebounced$ = searchActions$.pipe(filter((a) => a.payload.pageToken == null && a.payload.query.trim() !== ''), debounceTime(300));
22
- return merge(pagination$, newSearchClear$, newSearchDebounced$).pipe(switchMap((action) => {
19
+ /**
20
+ * No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
21
+ */
22
+ const newSearchTooShortOrClear$ = searchActions$.pipe(filter((a) => a.payload.pageToken == null &&
23
+ a.payload.query.trim().length < 2));
24
+ const newSearchDebounced$ = searchActions$.pipe(filter((a) => a.payload.pageToken == null &&
25
+ a.payload.query.trim().length >= 2), debounceTime(300));
26
+ return merge(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe(switchMap((action) => {
23
27
  const { query, pageToken } = action.payload;
24
- if (pageToken == null && query.trim() === '') {
28
+ if (pageToken == null &&
29
+ query.trim().length < 2) {
25
30
  return EMPTY;
26
31
  }
27
32
  const state = state$.value;
@@ -386,10 +386,11 @@ const expenseAutomationMissingReceiptsView = createSlice({
386
386
  const isLoadMore = pageToken != null;
387
387
  const trimmed = query.trim();
388
388
  /**
389
- * Cleared input: reset fully (no In-Progress) so we never show a loader with stale rows,
390
- * and the epic can cancel any in-flight search via switchMap without a debounce delay.
389
+ * Cleared or too-short query: no API (see epic). Reset fully (no In-Progress) so loading
390
+ * UI never shows; bump key so inputs remount.
391
391
  */
392
- if (!isLoadMore && trimmed === '') {
392
+ if (!isLoadMore &&
393
+ trimmed.length < 2) {
393
394
  draft.bulkUpload.manualSearch = initialBulkUploadState.manualSearch;
394
395
  draft.bulkUpload.manualSearchUiResetKey += 1;
395
396
  return;