@@ -210,6 +210,7 @@ export class VueHeaderActionsRenderer
210210 | { update : ( props : any ) => void ; dispose : ( ) => void }
211211 | undefined ;
212212 private readonly _mutableDisposable = new DockviewMutableDisposable ( ) ;
213+ private _baseProps : IGroupHeaderProps | undefined ;
213214
214215 get element ( ) : HTMLElement {
215216 return this . _element ;
@@ -224,35 +225,28 @@ export class VueHeaderActionsRenderer
224225 }
225226
226227 init ( props : IGroupHeaderProps ) : void {
228+ this . _baseProps = props ;
229+
227230 this . _mutableDisposable . value = new DockviewCompositeDisposable (
228231 this . group . model . onDidAddPanel ( ( ) => {
229- this . updatePanels ( ) ;
232+ this . updateProps ( ) ;
230233 } ) ,
231234 this . group . model . onDidRemovePanel ( ( ) => {
232- this . updatePanels ( ) ;
235+ this . updateProps ( ) ;
233236 } ) ,
234237 this . group . model . onDidActivePanelChange ( ( ) => {
235- this . updateActivePanel ( ) ;
238+ this . updateProps ( ) ;
236239 } ) ,
237240 props . api . onDidActiveChange ( ( ) => {
238- this . updateGroupActive ( ) ;
241+ this . updateProps ( ) ;
239242 } )
240243 ) ;
241244
242- const enrichedProps : IDockviewHeaderActionsProps = {
243- ...props ,
244- panels : this . group . model . panels ,
245- activePanel : this . group . model . activePanel ,
246- isGroupActive : this . group . api . isActive ,
247- group : this . group ,
248- headerPosition : this . group . model . headerPosition ,
249- } ;
250-
251245 this . _renderDisposable ?. dispose ( ) ;
252246 this . _renderDisposable = mountVueComponent (
253247 this . component ,
254248 this . parent ,
255- { params : enrichedProps } ,
249+ { params : this . buildEnrichedProps ( ) } ,
256250 this . element
257251 ) ;
258252 }
@@ -262,22 +256,19 @@ export class VueHeaderActionsRenderer
262256 this . _renderDisposable ?. dispose ( ) ;
263257 }
264258
265- private updatePanels ( ) : void {
266- this . _renderDisposable ?. update ( {
267- params : { panels : this . group . model . panels } ,
268- } ) ;
269- }
270-
271- private updateActivePanel ( ) : void {
272- this . _renderDisposable ?. update ( {
273- params : { activePanel : this . group . model . activePanel } ,
274- } ) ;
259+ private buildEnrichedProps ( ) : IDockviewHeaderActionsProps {
260+ return {
261+ ...this . _baseProps ! ,
262+ panels : this . group . model . panels ,
263+ activePanel : this . group . model . activePanel ,
264+ isGroupActive : this . group . api . isActive ,
265+ group : this . group ,
266+ headerPosition : this . group . model . headerPosition ,
267+ } ;
275268 }
276269
277- private updateGroupActive ( ) : void {
278- this . _renderDisposable ?. update ( {
279- params : { isGroupActive : this . group . api . isActive } ,
280- } ) ;
270+ private updateProps ( ) : void {
271+ this . _renderDisposable ?. update ( { params : this . buildEnrichedProps ( ) } ) ;
281272 }
282273}
283274
0 commit comments