@zeniai/client-epic-state 4.19.84-betaVR3 → 4.19.84-betaVR4
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.
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +8 -3
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +10 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -2
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +10 -0
- package/package.json +1 -1
package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js
CHANGED
|
@@ -19,9 +19,14 @@ exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
|
|
|
19
19
|
const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
20
20
|
const searchActions$ = actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.searchTransactionsForManualMatch.match));
|
|
21
21
|
const pagination$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken != null));
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/** Clears: no debounce so switchMap cancels in-flight HTTP from the previous query immediately. */
|
|
23
|
+
const newSearchClear$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null && a.payload.query.trim() === ''));
|
|
24
|
+
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null && a.payload.query.trim() !== ''), (0, operators_1.debounceTime)(300));
|
|
25
|
+
return (0, rxjs_1.merge)(pagination$, newSearchClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
24
26
|
const { query, pageToken } = action.payload;
|
|
27
|
+
if (pageToken == null && query.trim() === '') {
|
|
28
|
+
return rxjs_1.EMPTY;
|
|
29
|
+
}
|
|
25
30
|
const state = state$.value;
|
|
26
31
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
|
|
27
32
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
@@ -389,6 +389,16 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
389
389
|
reducer(draft, action) {
|
|
390
390
|
const { query, pageToken } = action.payload;
|
|
391
391
|
const isLoadMore = pageToken != null;
|
|
392
|
+
const trimmed = query.trim();
|
|
393
|
+
/**
|
|
394
|
+
* Cleared input: reset fully (no In-Progress) so we never show a loader with stale rows,
|
|
395
|
+
* and the epic can cancel any in-flight search via switchMap without a debounce delay.
|
|
396
|
+
*/
|
|
397
|
+
if (!isLoadMore && trimmed === '') {
|
|
398
|
+
draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
|
|
399
|
+
draft.bulkUpload.manualSearchUiResetKey += 1;
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
392
402
|
draft.bulkUpload.manualSearch.searchQuery = query;
|
|
393
403
|
if (isLoadMore) {
|
|
394
404
|
draft.bulkUpload.manualSearch.isLoadingMore = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.84-
|
|
3
|
+
"version": "4.19.84-betaVR4",
|
|
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",
|