@zeniai/client-epic-state 5.1.18-betaRD1 → 5.1.18-betaRD2
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.
|
@@ -164,23 +164,25 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
164
164
|
searchString;
|
|
165
165
|
}
|
|
166
166
|
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
167
|
+
const monthYearPeriod = {
|
|
168
|
+
month: period.start.month,
|
|
169
|
+
year: period.start.year,
|
|
170
|
+
};
|
|
171
|
+
const periodId = toMonthYearPeriodId(monthYearPeriod);
|
|
172
|
+
const transactionIdsBySelectedPeriod = draft.transactionCategorizationView[selectedTab]
|
|
173
|
+
.transactionIdsBySelectedPeriod[periodId] ?? [];
|
|
174
|
+
// Snapshot before any list mutation so clearing the search restores
|
|
175
|
+
// instantly without an API round-trip — for BOTH active and synced tabs.
|
|
176
|
+
// Active-tab search dispatches resetListItems=false, so this must live
|
|
177
|
+
// outside the resetListItems block. fullDatasetSnapshot == null prevents
|
|
178
|
+
// overwriting the original snapshot on search refinement ('ama'→'amazon').
|
|
179
|
+
if (searchString !== undefined &&
|
|
180
|
+
searchString !== '' &&
|
|
181
|
+
transactionIdsBySelectedPeriod.length > 0 &&
|
|
182
|
+
draft.transactionCategorizationView[selectedTab].fullDatasetSnapshot ==
|
|
183
|
+
null) {
|
|
184
|
+
draft.transactionCategorizationView[selectedTab].fullDatasetSnapshot =
|
|
185
|
+
{
|
|
184
186
|
parentTotalCount: draft.parentTotalCountByTab[selectedTab][periodId],
|
|
185
187
|
periodId,
|
|
186
188
|
totalCount: draft.transactionCategorizationView[selectedTab].uiState
|
|
@@ -191,16 +193,16 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
191
193
|
.transactionReviewLocalDataById,
|
|
192
194
|
},
|
|
193
195
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
}
|
|
197
|
+
// Reset list when we change the sort order and fetch list again
|
|
198
|
+
if (resetListItems === true) {
|
|
197
199
|
transactionIdsBySelectedPeriod.forEach((transactionId) => {
|
|
198
200
|
delete draft.transactionCategorizationView[selectedTab]
|
|
199
201
|
.transactionReviewLocalDataById[transactionId];
|
|
200
202
|
});
|
|
201
203
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds =
|
|
202
204
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds.filter((selectedCheckBoxTransactionId) => transactionIdsBySelectedPeriod.includes(selectedCheckBoxTransactionId));
|
|
203
|
-
draft.transactionCategorizationView[selectedTab].transactionIdsBySelectedPeriod[
|
|
205
|
+
draft.transactionCategorizationView[selectedTab].transactionIdsBySelectedPeriod[periodId] = [];
|
|
204
206
|
draft.transactionCategorizationView[selectedTab].refreshStatus = {
|
|
205
207
|
fetchState: 'Not-Started',
|
|
206
208
|
error: undefined,
|
|
@@ -171,23 +171,25 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
171
171
|
searchString;
|
|
172
172
|
}
|
|
173
173
|
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
const monthYearPeriod = {
|
|
175
|
+
month: period.start.month,
|
|
176
|
+
year: period.start.year,
|
|
177
|
+
};
|
|
178
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(monthYearPeriod);
|
|
179
|
+
const transactionIdsBySelectedPeriod = draft.transactionCategorizationView[selectedTab]
|
|
180
|
+
.transactionIdsBySelectedPeriod[periodId] ?? [];
|
|
181
|
+
// Snapshot before any list mutation so clearing the search restores
|
|
182
|
+
// instantly without an API round-trip — for BOTH active and synced tabs.
|
|
183
|
+
// Active-tab search dispatches resetListItems=false, so this must live
|
|
184
|
+
// outside the resetListItems block. fullDatasetSnapshot == null prevents
|
|
185
|
+
// overwriting the original snapshot on search refinement ('ama'→'amazon').
|
|
186
|
+
if (searchString !== undefined &&
|
|
187
|
+
searchString !== '' &&
|
|
188
|
+
transactionIdsBySelectedPeriod.length > 0 &&
|
|
189
|
+
draft.transactionCategorizationView[selectedTab].fullDatasetSnapshot ==
|
|
190
|
+
null) {
|
|
191
|
+
draft.transactionCategorizationView[selectedTab].fullDatasetSnapshot =
|
|
192
|
+
{
|
|
191
193
|
parentTotalCount: draft.parentTotalCountByTab[selectedTab][periodId],
|
|
192
194
|
periodId,
|
|
193
195
|
totalCount: draft.transactionCategorizationView[selectedTab].uiState
|
|
@@ -198,16 +200,16 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
198
200
|
.transactionReviewLocalDataById,
|
|
199
201
|
},
|
|
200
202
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
}
|
|
204
|
+
// Reset list when we change the sort order and fetch list again
|
|
205
|
+
if (resetListItems === true) {
|
|
204
206
|
transactionIdsBySelectedPeriod.forEach((transactionId) => {
|
|
205
207
|
delete draft.transactionCategorizationView[selectedTab]
|
|
206
208
|
.transactionReviewLocalDataById[transactionId];
|
|
207
209
|
});
|
|
208
210
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds =
|
|
209
211
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds.filter((selectedCheckBoxTransactionId) => transactionIdsBySelectedPeriod.includes(selectedCheckBoxTransactionId));
|
|
210
|
-
draft.transactionCategorizationView[selectedTab].transactionIdsBySelectedPeriod[
|
|
212
|
+
draft.transactionCategorizationView[selectedTab].transactionIdsBySelectedPeriod[periodId] = [];
|
|
211
213
|
draft.transactionCategorizationView[selectedTab].refreshStatus = {
|
|
212
214
|
fetchState: 'Not-Started',
|
|
213
215
|
error: undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.18-
|
|
3
|
+
"version": "5.1.18-betaRD2",
|
|
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",
|