@zeniai/client-epic-state 4.19.84-betaVR5 → 4.19.84-betaVR7

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.
@@ -9,7 +9,6 @@ const transactionReducer_1 = require("../../../../entity/transaction/transaction
9
9
  const responsePayload_1 = require("../../../../responsePayload");
10
10
  const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
11
11
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
12
- const missingReceiptsViewState_1 = require("../../types/missingReceiptsViewState");
13
12
  const transactionsViewState_1 = require("../../types/transactionsViewState");
14
13
  /**
15
14
  * `auto_categorized` for manual transaction search (Unmatched).
@@ -24,13 +23,13 @@ const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
24
23
  * No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
25
24
  */
26
25
  const newSearchTooShortOrClear$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null &&
27
- a.payload.query.trim().length < missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH));
26
+ a.payload.query.trim().length < 2));
28
27
  const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null &&
29
- a.payload.query.trim().length >= missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH), (0, operators_1.debounceTime)(300));
28
+ a.payload.query.trim().length >= 2), (0, operators_1.debounceTime)(300));
30
29
  return (0, rxjs_1.merge)(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
31
30
  const { query, pageToken } = action.payload;
32
31
  if (pageToken == null &&
33
- query.trim().length < missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH) {
32
+ query.trim().length < 2) {
34
33
  return rxjs_1.EMPTY;
35
34
  }
36
35
  const state = state$.value;
@@ -392,13 +392,20 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
392
392
  const isLoadMore = pageToken != null;
393
393
  const trimmed = query.trim();
394
394
  /**
395
- * Cleared or too-short query: no API (see epic). Reset fully (no In-Progress) so loading
396
- * UI never shows; bump key so inputs remount.
395
+ * Cleared or too-short query: no API (see epic). Reset fully (no In-Progress).
396
+ * Only bump `manualSearchUiResetKey` when clearing a real search — not when the UI
397
+ * dispatches `""` on every keystroke while length is below MIN (web-components always sends
398
+ * `onSearch("")` in that case), or ReceiptCard remounts and the input loses focus.
397
399
  */
398
400
  if (!isLoadMore &&
399
401
  trimmed.length < missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH) {
402
+ const hadActiveSearch = draft.bulkUpload.manualSearch.searchQuery.trim().length >=
403
+ missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH ||
404
+ draft.bulkUpload.manualSearch.results.length > 0;
400
405
  draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
401
- draft.bulkUpload.manualSearchUiResetKey += 1;
406
+ if (hadActiveSearch) {
407
+ draft.bulkUpload.manualSearchUiResetKey += 1;
408
+ }
402
409
  return;
403
410
  }
404
411
  draft.bulkUpload.manualSearch.searchQuery = query;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.84-betaVR5",
3
+ "version": "4.19.84-betaVR7",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",