@zeniai/client-epic-state 5.1.20-betaRD2 → 5.1.20-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.
@@ -48,15 +48,18 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
48
48
  }
49
49
  // When clearing search (searchString === ''), restore from the pre-search
50
50
  // snapshot if one exists — avoids a round-trip since all data is already
51
- // in the entity store. Fall back to a normal fetch if no snapshot (the
52
- // tab was never loaded before the search was applied).
51
+ // in the entity store. Fall back to a fresh fetch if no snapshot (either
52
+ // the tab was never loaded, or the snapshot was invalidated because a
53
+ // categorization happened during search).
54
+ const clearingSearchWithNoSnapshot = searchString === '' && !hasUsableSnapshot(selectedTab);
53
55
  if (searchString === '' && hasUsableSnapshot(selectedTab)) {
54
56
  updateActions.push(restoreFullDatasetSnapshot({ selectedTab, period }));
55
57
  }
56
- else if (cacheOverride === true ||
58
+ else if (clearingSearchWithNoSnapshot ||
59
+ cacheOverride === true ||
57
60
  fetchState === 'Not-Started' ||
58
61
  transactionIds.length === 0) {
59
- updateActions.push(fetchTransactionCategorization(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
62
+ updateActions.push(fetchTransactionCategorization(selectedTab, period, clearingSearchWithNoSnapshot ? true : cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, clearingSearchWithNoSnapshot ? true : resetListItems, isUncategorizedExpenseCategoryEnabled));
60
63
  }
61
64
  // On the initial load of a tab (searchString undefined = non-search fetch),
62
65
  // preload every other tab that hasn't been fetched yet for this period.
@@ -51,15 +51,18 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
51
51
  }
52
52
  // When clearing search (searchString === ''), restore from the pre-search
53
53
  // snapshot if one exists — avoids a round-trip since all data is already
54
- // in the entity store. Fall back to a normal fetch if no snapshot (the
55
- // tab was never loaded before the search was applied).
54
+ // in the entity store. Fall back to a fresh fetch if no snapshot (either
55
+ // the tab was never loaded, or the snapshot was invalidated because a
56
+ // categorization happened during search).
57
+ const clearingSearchWithNoSnapshot = searchString === '' && !hasUsableSnapshot(selectedTab);
56
58
  if (searchString === '' && hasUsableSnapshot(selectedTab)) {
57
59
  updateActions.push((0, transactionsViewReducer_1.restoreFullDatasetSnapshot)({ selectedTab, period }));
58
60
  }
59
- else if (cacheOverride === true ||
61
+ else if (clearingSearchWithNoSnapshot ||
62
+ cacheOverride === true ||
60
63
  fetchState === 'Not-Started' ||
61
64
  transactionIds.length === 0) {
62
- updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
65
+ updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, clearingSearchWithNoSnapshot ? true : cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, clearingSearchWithNoSnapshot ? true : resetListItems, isUncategorizedExpenseCategoryEnabled));
63
66
  }
64
67
  // On the initial load of a tab (searchString undefined = non-search fetch),
65
68
  // preload every other tab that hasn't been fetched yet for this period.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.20-betaRD2",
3
+ "version": "5.1.20-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",