@@ -13,7 +13,6 @@ import { ipcContext } from '../../shared/contexts/ipc';
1313import type { TelemetryContext } from '../../shared/contexts/telemetry' ;
1414import { telemetryContext } from '../../shared/contexts/telemetry' ;
1515import { emitTelemetrySentEvent } from '../../shared/telemetry' ;
16- import { stateContext } from './context' ;
1716import type { GlGraphWrapper } from './graph-wrapper/graph-wrapper' ;
1817import type { GlGraphHover } from './hover/graphHover' ;
1918import type { GraphMinimapDaySelectedEventDetail } from './minimap/minimap' ;
@@ -36,11 +35,8 @@ export class GraphApp extends SignalWatcher(LitElement) {
3635 return this ;
3736 }
3837
39- @consume ( { context : stateContext , subscribe : true } )
40- state ! : typeof stateContext . __context__ ;
41-
4238 @consume ( { context : graphStateContext , subscribe : true } )
43- graphApp ! : typeof graphStateContext . __context__ ;
39+ graphState ! : typeof graphStateContext . __context__ ;
4440
4541 @consume ( { context : ipcContext } )
4642 private readonly _ipc ! : typeof ipcContext . __context__ ;
@@ -76,27 +72,33 @@ export class GraphApp extends SignalWatcher(LitElement) {
7672 @gl-select-commits =${ this . handleHeaderSearchNavigation }
7773 > </ gl-graph-header >
7874 < div class ="graph__workspace ">
79- ${ when ( ! this . state . allowed , ( ) => html `< gl-graph-gate class ="graph__gate "> </ gl-graph-gate > ` ) }
75+ ${ when (
76+ ! this . graphState . state . allowed ,
77+ ( ) => html `< gl-graph-gate class ="graph__gate "> </ gl-graph-gate > ` ,
78+ ) }
8079 < main id ="main " class ="graph__panes ">
8180 < div class ="graph__graph-pane ">
8281 ${ when (
83- this . state . config ?. minimap !== false ,
82+ this . graphState . state . config ?. minimap !== false ,
8483 ( ) => html `
8584 < gl-graph-minimap-container
86- .activeDay =${ this . graphApp . activeDay }
87- .disabled =${ ! this . state . config ?. minimap }
88- .rows=${ this . state . rows ?? [ ] }
89- .rowsStats=${ this . state . rowsStats }
90- .dataType=${ this . state . config ?. minimapDataType ?? 'commits' }
91- .markerTypes=${ this . state . config ?. minimapMarkerTypes ?? [ ] }
92- .refMetadata=${ this . state . refsMetadata }
93- .searchResults=${ this . graphApp . searchResults }
94- .visibleDays=${ this . graphApp . visibleDays }
85+ .activeDay =${ this . graphState . activeDay }
86+ .disabled =${ ! this . graphState . state . config ?. minimap }
87+ .rows=${ this . graphState . state . rows ?? [ ] }
88+ .rowsStats=${ this . graphState . state . rowsStats }
89+ .dataType=${ this . graphState . state . config ?. minimapDataType ?? 'commits' }
90+ .markerTypes=${ this . graphState . state . config ?. minimapMarkerTypes ?? [ ] }
91+ .refMetadata=${ this . graphState . state . refsMetadata }
92+ .searchResults=${ this . graphState . searchResults }
93+ .visibleDays=${ this . graphState . visibleDays }
9594 @gl-graph-minimap-selected=${ this . handleMinimapDaySelected }
9695 > </ gl-graph-minimap-container >
9796 ` ,
9897 ) }
99- ${ when ( this . state . config ?. sidebar , ( ) => html `< gl-graph-sidebar > </ gl-graph-sidebar > ` ) }
98+ ${ when (
99+ this . graphState . state . config ?. sidebar ,
100+ ( ) => html `< gl-graph-sidebar > </ gl-graph-sidebar > ` ,
101+ ) }
100102 < gl-graph-hover id ="commit-hover " distance =${ 0 } skidding =${ 15 } > </ gl-graph-hover >
101103 < gl-graph-wrapper
102104 @gl-graph-change-selection =${ this . handleGraphSelectionChanged }
@@ -119,15 +121,15 @@ export class GraphApp extends SignalWatcher(LitElement) {
119121 }
120122
121123 private handleMinimapDaySelected ( e : CustomEvent < GraphMinimapDaySelectedEventDetail > ) {
122- if ( ! this . state . rows ) return ;
124+ if ( ! this . graphState . state . rows ) return ;
123125
124126 let { sha } = e . detail ;
125127 if ( sha == null ) {
126128 const date = e . detail . date ?. getTime ( ) ;
127129 if ( date == null ) return ;
128130
129131 // Find closest row to the date
130- const closest = this . state . rows . reduce ( ( prev , curr ) => {
132+ const closest = this . graphState . state . rows . reduce ( ( prev , curr ) => {
131133 return Math . abs ( curr . date - date ) < Math . abs ( prev . date - date ) ? curr : prev ;
132134 } ) ;
133135 sha = closest . sha ;
@@ -161,7 +163,7 @@ export class GraphApp extends SignalWatcher(LitElement) {
161163 }
162164
163165 private handleGraphVisibleDaysChanged ( { detail } : CustomEventType < 'gl-graph-change-visible-days' > ) {
164- this . graphApp . visibleDays = detail ;
166+ this . graphState . visibleDays = detail ;
165167 }
166168
167169 private handleGraphRowContextMenu ( _e : CustomEventType < 'gl-graph-row-context-menu' > ) {
0 commit comments