@@ -404,7 +404,7 @@ const {initialState, reducers: namespaceContextedReducer} =
404
404
pins : [ ] ,
405
405
clicks : [ ] ,
406
406
} ,
407
- cardInteractions : {
407
+ newCardInteractions : {
408
408
tagFilters : [ ] ,
409
409
pins : [ ] ,
410
410
clicks : [ ] ,
@@ -741,39 +741,41 @@ const reducer = createReducer(
741
741
} ;
742
742
} ) ,
743
743
on ( actions . metricsTagFilterChanged , ( state , { tagFilter} ) => {
744
- const nextCardInteractions = {
745
- ...state . cardInteractions ,
744
+ const nextNewCardInteractions = {
745
+ ...state . newCardInteractions ,
746
746
} ;
747
747
const previousTagFilter = state . tagFilter ;
748
748
// Ensuring we do not create redundant tag filter as the user types
749
749
if ( tagFilter === '' ) {
750
- nextCardInteractions . tagFilters = nextCardInteractions . tagFilters . slice (
751
- 0 ,
752
- nextCardInteractions . tagFilters . length - 1
753
- ) ;
750
+ nextNewCardInteractions . tagFilters =
751
+ nextNewCardInteractions . tagFilters . slice (
752
+ 0 ,
753
+ nextNewCardInteractions . tagFilters . length - 1
754
+ ) ;
754
755
} else if (
755
756
previousTagFilter === '' ||
756
- ! nextCardInteractions . tagFilters . length
757
+ ! nextNewCardInteractions . tagFilters . length
757
758
) {
758
- nextCardInteractions . tagFilters = [
759
- ...nextCardInteractions . tagFilters ,
759
+ nextNewCardInteractions . tagFilters = [
760
+ ...nextNewCardInteractions . tagFilters ,
760
761
tagFilter ,
761
762
] ;
762
763
} else if (
763
764
tagFilter . includes ( previousTagFilter ) ||
764
765
previousTagFilter . includes ( tagFilter )
765
766
) {
766
- nextCardInteractions . tagFilters = nextCardInteractions . tagFilters . slice (
767
- 0 ,
768
- nextCardInteractions . tagFilters . length - 1
769
- ) ;
770
- nextCardInteractions . tagFilters . push ( tagFilter ) ;
767
+ nextNewCardInteractions . tagFilters =
768
+ nextNewCardInteractions . tagFilters . slice (
769
+ 0 ,
770
+ nextNewCardInteractions . tagFilters . length - 1
771
+ ) ;
772
+ nextNewCardInteractions . tagFilters . push ( tagFilter ) ;
771
773
}
772
774
773
775
return {
774
776
...state ,
775
777
tagFilter,
776
- cardInteractions : nextCardInteractions ,
778
+ cardInteractions : nextNewCardInteractions ,
777
779
} ;
778
780
} ) ,
779
781
on ( actions . metricsChangeTooltipSort , ( state , { sort} ) => {
@@ -1127,7 +1129,7 @@ const reducer = createReducer(
1127
1129
let nextCardMetadataMap = { ...state . cardMetadataMap } ;
1128
1130
let nextCardStepIndexMap = { ...state . cardStepIndex } ;
1129
1131
let nextCardStateMap = { ...state . cardStateMap } ;
1130
- const nextCardInteractions = { ...state . cardInteractions } ;
1132
+ const nextNewCardInteractions = { ...state . newCardInteractions } ;
1131
1133
const nextPreviousCardInteractions = { ...state . previousCardInteractions } ;
1132
1134
1133
1135
if ( isPinnedCopy ) {
@@ -1138,7 +1140,7 @@ const reducer = createReducer(
1138
1140
delete nextCardMetadataMap [ cardId ] ;
1139
1141
delete nextCardStepIndexMap [ cardId ] ;
1140
1142
delete nextCardStateMap [ cardId ] ;
1141
- nextCardInteractions . pins = nextCardInteractions . pins . filter (
1143
+ nextNewCardInteractions . pins = nextNewCardInteractions . pins . filter (
1142
1144
( cardMetadata ) => originalCardId !== cardMetadata . cardId
1143
1145
) ;
1144
1146
nextPreviousCardInteractions . pins =
@@ -1163,12 +1165,12 @@ const reducer = createReducer(
1163
1165
nextCardStepIndexMap = resolvedResult . cardStepIndex ;
1164
1166
nextCardStateMap = resolvedResult . cardStateMap ;
1165
1167
if (
1166
- ! nextCardInteractions . pins . find (
1168
+ ! nextNewCardInteractions . pins . find (
1167
1169
( metadata ) => cardId === metadata . cardId
1168
1170
)
1169
1171
) {
1170
- nextCardInteractions . pins = [
1171
- ...nextCardInteractions . pins ,
1172
+ nextNewCardInteractions . pins = [
1173
+ ...nextNewCardInteractions . pins ,
1172
1174
{ ...nextCardMetadataMap [ cardId ] , cardId} ,
1173
1175
] ;
1174
1176
}
@@ -1190,7 +1192,7 @@ const reducer = createReducer(
1190
1192
cardToPinnedCopy : nextCardToPinnedCopy ,
1191
1193
cardToPinnedCopyCache : nextCardToPinnedCopyCache ,
1192
1194
pinnedCardToOriginal : nextPinnedCardToOriginal ,
1193
- cardInteractions : nextCardInteractions ,
1195
+ cardInteractions : nextNewCardInteractions ,
1194
1196
previousCardInteractions : nextPreviousCardInteractions ,
1195
1197
} ;
1196
1198
} ) ,
@@ -1538,12 +1540,12 @@ const reducer = createReducer(
1538
1540
) ,
1539
1541
on ( actions . metricsCardClicked , ( state , { cardId} ) => {
1540
1542
const nextClicksIds = new Set (
1541
- state . cardInteractions . clicks . map ( ( { cardId} ) => cardId )
1543
+ state . newCardInteractions . clicks . map ( ( { cardId} ) => cardId )
1542
1544
) ;
1543
1545
nextClicksIds . add ( cardId ) ;
1544
1546
1545
- const nextCardInteractions = {
1546
- ...state . cardInteractions ,
1547
+ const nextNewCardInteractions = {
1548
+ ...state . newCardInteractions ,
1547
1549
clicks : Array . from ( nextClicksIds ) . map ( ( cardId ) => ( {
1548
1550
...state . cardMetadataMap [ cardId ] ,
1549
1551
cardId,
@@ -1552,7 +1554,7 @@ const reducer = createReducer(
1552
1554
1553
1555
return {
1554
1556
...state ,
1555
- cardInteractions : nextCardInteractions ,
1557
+ newCardInteractions : nextNewCardInteractions ,
1556
1558
} ;
1557
1559
} )
1558
1560
) ;
0 commit comments