@zeniai/client-epic-state 5.1.16-betaRD1 → 5.1.16-betaRD3
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/transactionCategorization/fetchTransactionCategorizationEpic.js +5 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +20 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +5 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +20 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -4
- package/package.json +1 -1
|
@@ -18,6 +18,11 @@ groupBy((action) => action.payload.selectedTab), mergeMap((group$) => group$.pip
|
|
|
18
18
|
const { pageToken, sortOrder, sortKey } = uiState;
|
|
19
19
|
const currentTenant = getCurrentTenant(state$.value);
|
|
20
20
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
21
|
+
console.log('[EA-SEARCH] fetchTransactionCategorizationEpic HTTP call', {
|
|
22
|
+
selectedTab,
|
|
23
|
+
refreshViewInBackground,
|
|
24
|
+
search_text: uiState.searchString,
|
|
25
|
+
});
|
|
21
26
|
const queryParam = {
|
|
22
27
|
start_date: toString(period.start),
|
|
23
28
|
end_date: toString(period.end),
|
|
@@ -13,6 +13,12 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
13
13
|
const updateActions = [];
|
|
14
14
|
const { expenseAutomationTransactionsViewState } = state$.value;
|
|
15
15
|
const { fetchState, transactionIdsBySelectedPeriod } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTab];
|
|
16
|
+
console.log('[EA-SEARCH] fetchTransactionCategorizationViewEpic received', {
|
|
17
|
+
selectedTab,
|
|
18
|
+
cacheOverride,
|
|
19
|
+
searchString,
|
|
20
|
+
fetchState,
|
|
21
|
+
});
|
|
16
22
|
const monthYearPeriod = {
|
|
17
23
|
month: period.start.month,
|
|
18
24
|
year: period.start.year,
|
|
@@ -40,9 +46,16 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
40
46
|
vendorOwnerList.fetchState === 'Not-Started') {
|
|
41
47
|
updateActions.push(fetchOwnerList());
|
|
42
48
|
}
|
|
49
|
+
console.log('[EA-SEARCH] view epic cache check', {
|
|
50
|
+
selectedTab,
|
|
51
|
+
cacheOverride,
|
|
52
|
+
fetchState,
|
|
53
|
+
transactionIdsBySelectedPeriod
|
|
54
|
+
});
|
|
43
55
|
if (cacheOverride === true ||
|
|
44
56
|
fetchState === 'Not-Started' ||
|
|
45
57
|
transactionIds.length === 0) {
|
|
58
|
+
console.log('[EA-SEARCH] dispatching fetchTransactionCategorization for active tab', { selectedTab, searchString });
|
|
46
59
|
updateActions.push(fetchTransactionCategorization(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
|
|
47
60
|
}
|
|
48
61
|
// When search changes (searchString defined, including empty string to
|
|
@@ -55,7 +68,14 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
55
68
|
if (searchString !== undefined) {
|
|
56
69
|
TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
|
|
57
70
|
const otherTabSearchString = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].uiState.searchString;
|
|
71
|
+
console.log('[EA-SEARCH] dual-fetch check for other tab', {
|
|
72
|
+
otherTab,
|
|
73
|
+
searchString,
|
|
74
|
+
otherTabSearchString,
|
|
75
|
+
willDispatch: searchString !== otherTabSearchString,
|
|
76
|
+
});
|
|
58
77
|
if (searchString !== otherTabSearchString) {
|
|
78
|
+
console.log('[EA-SEARCH] dispatching fetchTransactionCategorization for other tab', { otherTab, searchString });
|
|
59
79
|
updateActions.push(fetchTransactionCategorization(otherTab, period, true, keepExistingListItems, searchString, undefined, true, true, isUncategorizedExpenseCategoryEnabled));
|
|
60
80
|
}
|
|
61
81
|
});
|
|
@@ -666,18 +666,24 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
666
666
|
resetOtherTabsFetchState(draft, action) {
|
|
667
667
|
const { tabs, refreshViewInBackground } = action.payload;
|
|
668
668
|
tabs.forEach((tab) => {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
669
|
+
const tabFetchState = draft.transactionCategorizationView[tab].fetchState;
|
|
670
|
+
if (refreshViewInBackground !== true) {
|
|
671
|
+
// Foreground fetch completed: mark other tabs as Completed.
|
|
672
672
|
draft.transactionCategorizationView[tab].fetchState = 'Completed';
|
|
673
673
|
draft.transactionCategorizationView[tab].error = undefined;
|
|
674
674
|
}
|
|
675
|
-
else {
|
|
675
|
+
else if (tabFetchState !== 'In-Progress') {
|
|
676
|
+
// Background fetch completed: reset the other tab's refreshStatus,
|
|
677
|
+
// but only when it is not mid-load. During a dual-search the active
|
|
678
|
+
// tab has its own foreground fetch in flight — clobbering its
|
|
679
|
+
// fetchState here would drop the skeleton and show an empty list.
|
|
676
680
|
draft.transactionCategorizationView[tab].refreshStatus = {
|
|
677
681
|
fetchState: 'Not-Started',
|
|
678
682
|
error: undefined,
|
|
679
683
|
};
|
|
680
684
|
}
|
|
685
|
+
// If tabFetchState === 'In-Progress' and refreshViewInBackground === true,
|
|
686
|
+
// leave the other tab's state untouched — it has its own active fetch.
|
|
681
687
|
});
|
|
682
688
|
},
|
|
683
689
|
fetchTransactionCategorizationFailure(draft, action) {
|
|
@@ -21,6 +21,11 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
|
|
|
21
21
|
const { pageToken, sortOrder, sortKey } = uiState;
|
|
22
22
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
23
23
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
24
|
+
console.log('[EA-SEARCH] fetchTransactionCategorizationEpic HTTP call', {
|
|
25
|
+
selectedTab,
|
|
26
|
+
refreshViewInBackground,
|
|
27
|
+
search_text: uiState.searchString,
|
|
28
|
+
});
|
|
24
29
|
const queryParam = {
|
|
25
30
|
start_date: (0, timePeriod_1.toString)(period.start),
|
|
26
31
|
end_date: (0, timePeriod_1.toString)(period.end),
|
|
@@ -16,6 +16,12 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
16
16
|
const updateActions = [];
|
|
17
17
|
const { expenseAutomationTransactionsViewState } = state$.value;
|
|
18
18
|
const { fetchState, transactionIdsBySelectedPeriod } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTab];
|
|
19
|
+
console.log('[EA-SEARCH] fetchTransactionCategorizationViewEpic received', {
|
|
20
|
+
selectedTab,
|
|
21
|
+
cacheOverride,
|
|
22
|
+
searchString,
|
|
23
|
+
fetchState,
|
|
24
|
+
});
|
|
19
25
|
const monthYearPeriod = {
|
|
20
26
|
month: period.start.month,
|
|
21
27
|
year: period.start.year,
|
|
@@ -43,9 +49,16 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
43
49
|
vendorOwnerList.fetchState === 'Not-Started') {
|
|
44
50
|
updateActions.push((0, ownerListReducer_1.fetchOwnerList)());
|
|
45
51
|
}
|
|
52
|
+
console.log('[EA-SEARCH] view epic cache check', {
|
|
53
|
+
selectedTab,
|
|
54
|
+
cacheOverride,
|
|
55
|
+
fetchState,
|
|
56
|
+
transactionIdsBySelectedPeriod
|
|
57
|
+
});
|
|
46
58
|
if (cacheOverride === true ||
|
|
47
59
|
fetchState === 'Not-Started' ||
|
|
48
60
|
transactionIds.length === 0) {
|
|
61
|
+
console.log('[EA-SEARCH] dispatching fetchTransactionCategorization for active tab', { selectedTab, searchString });
|
|
49
62
|
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
|
|
50
63
|
}
|
|
51
64
|
// When search changes (searchString defined, including empty string to
|
|
@@ -58,7 +71,14 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
58
71
|
if (searchString !== undefined) {
|
|
59
72
|
transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
|
|
60
73
|
const otherTabSearchString = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].uiState.searchString;
|
|
74
|
+
console.log('[EA-SEARCH] dual-fetch check for other tab', {
|
|
75
|
+
otherTab,
|
|
76
|
+
searchString,
|
|
77
|
+
otherTabSearchString,
|
|
78
|
+
willDispatch: searchString !== otherTabSearchString,
|
|
79
|
+
});
|
|
61
80
|
if (searchString !== otherTabSearchString) {
|
|
81
|
+
console.log('[EA-SEARCH] dispatching fetchTransactionCategorization for other tab', { otherTab, searchString });
|
|
62
82
|
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, true, keepExistingListItems, searchString, undefined, true, true, isUncategorizedExpenseCategoryEnabled));
|
|
63
83
|
}
|
|
64
84
|
});
|
|
@@ -673,18 +673,24 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
673
673
|
resetOtherTabsFetchState(draft, action) {
|
|
674
674
|
const { tabs, refreshViewInBackground } = action.payload;
|
|
675
675
|
tabs.forEach((tab) => {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
676
|
+
const tabFetchState = draft.transactionCategorizationView[tab].fetchState;
|
|
677
|
+
if (refreshViewInBackground !== true) {
|
|
678
|
+
// Foreground fetch completed: mark other tabs as Completed.
|
|
679
679
|
draft.transactionCategorizationView[tab].fetchState = 'Completed';
|
|
680
680
|
draft.transactionCategorizationView[tab].error = undefined;
|
|
681
681
|
}
|
|
682
|
-
else {
|
|
682
|
+
else if (tabFetchState !== 'In-Progress') {
|
|
683
|
+
// Background fetch completed: reset the other tab's refreshStatus,
|
|
684
|
+
// but only when it is not mid-load. During a dual-search the active
|
|
685
|
+
// tab has its own foreground fetch in flight — clobbering its
|
|
686
|
+
// fetchState here would drop the skeleton and show an empty list.
|
|
683
687
|
draft.transactionCategorizationView[tab].refreshStatus = {
|
|
684
688
|
fetchState: 'Not-Started',
|
|
685
689
|
error: undefined,
|
|
686
690
|
};
|
|
687
691
|
}
|
|
692
|
+
// If tabFetchState === 'In-Progress' and refreshViewInBackground === true,
|
|
693
|
+
// leave the other tab's state untouched — it has its own active fetch.
|
|
688
694
|
});
|
|
689
695
|
},
|
|
690
696
|
fetchTransactionCategorizationFailure(draft, action) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.16-
|
|
3
|
+
"version": "5.1.16-betaRD3",
|
|
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",
|