@zeniai/client-epic-state 5.1.16-betaRD5 → 5.1.16-betaRD6

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.
@@ -58,6 +58,18 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
58
58
  transactionIds.length === 0) {
59
59
  updateActions.push(fetchTransactionCategorization(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
60
60
  }
61
+ // On the initial load of a tab (searchString undefined = non-search fetch),
62
+ // preload every other tab that hasn't been fetched yet for this period.
63
+ // This makes switching to the other tab instant instead of triggering a
64
+ // fresh fetch on click. refreshViewInBackground=true keeps it silent.
65
+ if (searchString === undefined) {
66
+ TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
67
+ const otherTabFetchState = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].fetchState;
68
+ if (otherTabFetchState === 'Not-Started') {
69
+ updateActions.push(fetchTransactionCategorization(otherTab, period, false, false, undefined, undefined, true, undefined, isUncategorizedExpenseCategoryEnabled));
70
+ }
71
+ });
72
+ }
61
73
  // When search changes (searchString defined, including empty string to
62
74
  // clear), also update every other tab so all tabs always reflect the same
63
75
  // search query. Skip if the other tab already has this search string to
@@ -181,6 +181,7 @@ const expenseAutomationTransactionsView = createSlice({
181
181
  searchString !== '' &&
182
182
  transactionIdsBySelectedPeriod.length > 0) {
183
183
  const snapshot = {
184
+ parentTotalCount: draft.parentTotalCountByTab[selectedTab][periodId],
184
185
  periodId,
185
186
  totalCount: draft.transactionCategorizationView[selectedTab].uiState
186
187
  .totalCount[periodId],
@@ -733,6 +734,10 @@ const expenseAutomationTransactionsView = createSlice({
733
734
  if (snapshot.totalCount != null) {
734
735
  draft.transactionCategorizationView[selectedTab].uiState.totalCount[periodId] = snapshot.totalCount;
735
736
  }
737
+ if (snapshot.parentTotalCount != null) {
738
+ draft.parentTotalCountByTab[selectedTab][periodId] =
739
+ snapshot.parentTotalCount;
740
+ }
736
741
  draft.transactionCategorizationView[selectedTab].uiState.searchString =
737
742
  '';
738
743
  draft.transactionCategorizationView[selectedTab].uiState.pageToken = null;
@@ -61,6 +61,18 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
61
61
  transactionIds.length === 0) {
62
62
  updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
63
63
  }
64
+ // On the initial load of a tab (searchString undefined = non-search fetch),
65
+ // preload every other tab that hasn't been fetched yet for this period.
66
+ // This makes switching to the other tab instant instead of triggering a
67
+ // fresh fetch on click. refreshViewInBackground=true keeps it silent.
68
+ if (searchString === undefined) {
69
+ transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
70
+ const otherTabFetchState = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].fetchState;
71
+ if (otherTabFetchState === 'Not-Started') {
72
+ updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, false, false, undefined, undefined, true, undefined, isUncategorizedExpenseCategoryEnabled));
73
+ }
74
+ });
75
+ }
64
76
  // When search changes (searchString defined, including empty string to
65
77
  // clear), also update every other tab so all tabs always reflect the same
66
78
  // search query. Skip if the other tab already has this search string to
@@ -188,6 +188,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
188
188
  searchString !== '' &&
189
189
  transactionIdsBySelectedPeriod.length > 0) {
190
190
  const snapshot = {
191
+ parentTotalCount: draft.parentTotalCountByTab[selectedTab][periodId],
191
192
  periodId,
192
193
  totalCount: draft.transactionCategorizationView[selectedTab].uiState
193
194
  .totalCount[periodId],
@@ -740,6 +741,10 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
740
741
  if (snapshot.totalCount != null) {
741
742
  draft.transactionCategorizationView[selectedTab].uiState.totalCount[periodId] = snapshot.totalCount;
742
743
  }
744
+ if (snapshot.parentTotalCount != null) {
745
+ draft.parentTotalCountByTab[selectedTab][periodId] =
746
+ snapshot.parentTotalCount;
747
+ }
743
748
  draft.transactionCategorizationView[selectedTab].uiState.searchString =
744
749
  '';
745
750
  draft.transactionCategorizationView[selectedTab].uiState.pageToken = null;
@@ -103,6 +103,7 @@ export declare const initialSupportedTransactionCategorization: SupportedTransac
103
103
  * non-empty); cleared once consumed or replaced by a fresh search.
104
104
  */
105
105
  export interface FullDatasetSnapshot {
106
+ parentTotalCount: number | undefined;
106
107
  periodId: MonthYearPeriodId;
107
108
  totalCount: number | undefined;
108
109
  transactionIds: ID[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.16-betaRD5",
3
+ "version": "5.1.16-betaRD6",
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",