@zeniai/client-epic-state 5.2.38 → 5.2.39-betaRD1

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.
@@ -33,9 +33,18 @@ const financeStatement = createSlice({
33
33
  },
34
34
  },
35
35
  updateFinanceStatementTimeframe(draft, action) {
36
+ // Unrelated UI re-dispatches the *current* timeframe as a side effect (the
37
+ // reports page hangs its table scroll reset off that callback); dropping the
38
+ // anchor there would silently reset the user's period to the latest one.
39
+ if (draft.timeframe === action.payload) {
40
+ return;
41
+ }
36
42
  draft.timeframe = action.payload;
43
+ // A month anchor is meaningless once the timeframe becomes quarter/year, so
44
+ // a real change drops it and returns the width to the default — 12 months
45
+ // must not become 12 quarters. Order is the user's, so it survives.
37
46
  draft.selectedCOABalancesRange = {
38
- numberOfPeriods: draft.selectedCOABalancesRange.numberOfPeriods,
47
+ numberOfPeriods: initialFinanceStatementState.selectedCOABalancesRange.numberOfPeriods,
39
48
  orderBy: draft.selectedCOABalancesRange.orderBy,
40
49
  };
41
50
  },
@@ -77,8 +86,7 @@ const financeStatement = createSlice({
77
86
  draft.selectedReportId = action.payload;
78
87
  },
79
88
  updateFinanceStatementAdditionalBalancesSelection(draft, action) {
80
- const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
81
- const safeCoaBalances = coaBalances != null ? coaBalances : [];
89
+ const { additionalBalances: additionalBalancesPayload, maxNumOfPeriodsToHighlight, } = action.payload;
82
90
  const additionalBalances = additionalBalancesPayload ?? [];
83
91
  let tempAdditionalBalances = [...additionalBalances];
84
92
  if (additionalBalances.includes('this_period_vs_last_period') ||
@@ -94,30 +102,12 @@ const financeStatement = createSlice({
94
102
  draft.maxNumOfPeriodsToHighlight = maxNumOfPeriodsToHighlight;
95
103
  draft.isAdditionalBalancesShown =
96
104
  additionalBalances.length != 0 ? true : false;
97
- const { timeframe, selectedCOABalancesRange } = draft;
98
- if (safeCoaBalances.length > 0) {
99
- const thisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
100
- if (thisPeriod != null) {
101
- const selectedCoaBalancesRangeWithThisPeriod = {
102
- ...selectedCOABalancesRange,
103
- thisPeriod,
104
- };
105
- const selectionRanges = getSelectedAndHighlightedRangesForThisPeriod({
106
- firstMonthOfFY,
107
- thisPeriod: thisPeriod,
108
- coaBalances: safeCoaBalances,
109
- timeframe,
110
- maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
111
- currentSelection: {
112
- selectedCOABalancesRange: selectedCoaBalancesRangeWithThisPeriod,
113
- },
114
- orderBy: 'ascending_date',
115
- maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
116
- });
117
- draft.selectedCOABalancesRange =
118
- selectionRanges.selectedCOABalancesRange;
119
- }
120
- }
105
+ // Column metadata only must not touch selectedCOABalancesRange. The
106
+ // reports page fires this on load, on resize and on every fetch-state
107
+ // transition (so also on report switch and on remount after a drill-down)
108
+ // with a viewport-derived period count that knows nothing about the range
109
+ // the user picked. The width default comes from initial state, and from
110
+ // updateFinanceStatementTimeframe on a real timeframe change.
121
111
  },
122
112
  updateDownloadState(draft, action) {
123
113
  draft.downloadState = action.payload;