@@ -404,7 +404,7 @@ const {initialState, reducers: namespaceContextedReducer} =
404404 pins : [ ] ,
405405 clicks : [ ] ,
406406 } ,
407- cardInteractions : {
407+ newCardInteractions : {
408408 tagFilters : [ ] ,
409409 pins : [ ] ,
410410 clicks : [ ] ,
@@ -741,39 +741,41 @@ const reducer = createReducer(
741741 } ;
742742 } ) ,
743743 on ( actions . metricsTagFilterChanged , ( state , { tagFilter} ) => {
744- const nextCardInteractions = {
745- ...state . cardInteractions ,
744+ const nextNewCardInteractions = {
745+ ...state . newCardInteractions ,
746746 } ;
747747 const previousTagFilter = state . tagFilter ;
748748 // Ensuring we do not create redundant tag filter as the user types
749749 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+ ) ;
754755 } else if (
755756 previousTagFilter === '' ||
756- ! nextCardInteractions . tagFilters . length
757+ ! nextNewCardInteractions . tagFilters . length
757758 ) {
758- nextCardInteractions . tagFilters = [
759- ...nextCardInteractions . tagFilters ,
759+ nextNewCardInteractions . tagFilters = [
760+ ...nextNewCardInteractions . tagFilters ,
760761 tagFilter ,
761762 ] ;
762763 } else if (
763764 tagFilter . includes ( previousTagFilter ) ||
764765 previousTagFilter . includes ( tagFilter )
765766 ) {
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 ) ;
771773 }
772774
773775 return {
774776 ...state ,
775777 tagFilter,
776- cardInteractions : nextCardInteractions ,
778+ cardInteractions : nextNewCardInteractions ,
777779 } ;
778780 } ) ,
779781 on ( actions . metricsChangeTooltipSort , ( state , { sort} ) => {
@@ -1127,7 +1129,7 @@ const reducer = createReducer(
11271129 let nextCardMetadataMap = { ...state . cardMetadataMap } ;
11281130 let nextCardStepIndexMap = { ...state . cardStepIndex } ;
11291131 let nextCardStateMap = { ...state . cardStateMap } ;
1130- const nextCardInteractions = { ...state . cardInteractions } ;
1132+ const nextNewCardInteractions = { ...state . newCardInteractions } ;
11311133 const nextPreviousCardInteractions = { ...state . previousCardInteractions } ;
11321134
11331135 if ( isPinnedCopy ) {
@@ -1138,7 +1140,7 @@ const reducer = createReducer(
11381140 delete nextCardMetadataMap [ cardId ] ;
11391141 delete nextCardStepIndexMap [ cardId ] ;
11401142 delete nextCardStateMap [ cardId ] ;
1141- nextCardInteractions . pins = nextCardInteractions . pins . filter (
1143+ nextNewCardInteractions . pins = nextNewCardInteractions . pins . filter (
11421144 ( cardMetadata ) => originalCardId !== cardMetadata . cardId
11431145 ) ;
11441146 nextPreviousCardInteractions . pins =
@@ -1163,12 +1165,12 @@ const reducer = createReducer(
11631165 nextCardStepIndexMap = resolvedResult . cardStepIndex ;
11641166 nextCardStateMap = resolvedResult . cardStateMap ;
11651167 if (
1166- ! nextCardInteractions . pins . find (
1168+ ! nextNewCardInteractions . pins . find (
11671169 ( metadata ) => cardId === metadata . cardId
11681170 )
11691171 ) {
1170- nextCardInteractions . pins = [
1171- ...nextCardInteractions . pins ,
1172+ nextNewCardInteractions . pins = [
1173+ ...nextNewCardInteractions . pins ,
11721174 { ...nextCardMetadataMap [ cardId ] , cardId} ,
11731175 ] ;
11741176 }
@@ -1190,7 +1192,7 @@ const reducer = createReducer(
11901192 cardToPinnedCopy : nextCardToPinnedCopy ,
11911193 cardToPinnedCopyCache : nextCardToPinnedCopyCache ,
11921194 pinnedCardToOriginal : nextPinnedCardToOriginal ,
1193- cardInteractions : nextCardInteractions ,
1195+ cardInteractions : nextNewCardInteractions ,
11941196 previousCardInteractions : nextPreviousCardInteractions ,
11951197 } ;
11961198 } ) ,
@@ -1538,12 +1540,12 @@ const reducer = createReducer(
15381540 ) ,
15391541 on ( actions . metricsCardClicked , ( state , { cardId} ) => {
15401542 const nextClicksIds = new Set (
1541- state . cardInteractions . clicks . map ( ( { cardId} ) => cardId )
1543+ state . newCardInteractions . clicks . map ( ( { cardId} ) => cardId )
15421544 ) ;
15431545 nextClicksIds . add ( cardId ) ;
15441546
1545- const nextCardInteractions = {
1546- ...state . cardInteractions ,
1547+ const nextNewCardInteractions = {
1548+ ...state . newCardInteractions ,
15471549 clicks : Array . from ( nextClicksIds ) . map ( ( cardId ) => ( {
15481550 ...state . cardMetadataMap [ cardId ] ,
15491551 cardId,
@@ -1552,7 +1554,7 @@ const reducer = createReducer(
15521554
15531555 return {
15541556 ...state ,
1555- cardInteractions : nextCardInteractions ,
1557+ newCardInteractions : nextNewCardInteractions ,
15561558 } ;
15571559 } )
15581560) ;
0 commit comments