File tree Expand file tree Collapse file tree
src/components/BootstrapBlazor.DockView/Components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -174,12 +174,7 @@ protected override void OnParametersSet()
174174 base . OnParametersSet ( ) ;
175175
176176 // 同步组件状态到缓存
177- var state = DockView . GetComponentState ( Key ) ;
178- if ( state != null )
179- {
180- state . Visible = Visible ;
181- state . IsLock = IsLock ;
182- }
177+ DockView . UpdateComponentState ( Key , Visible , IsLock ) ;
183178 }
184179
185180 private async Task OnClickBar ( )
Original file line number Diff line number Diff line change @@ -379,7 +379,27 @@ internal void RemoveComponentState(string? key)
379379 }
380380 }
381381
382- internal DockViewComponentState ? GetComponentState ( string ? key )
382+ internal void UpdateComponentState ( string ? key , bool visible , bool ? isLock )
383+ {
384+ if ( Renderer == DockViewRenderMode . Always )
385+ {
386+ return ;
387+ }
388+
389+ if ( ! string . IsNullOrEmpty ( key ) && _componentStates . TryGetValue ( key , out var state ) )
390+ {
391+ state . Visible = visible ;
392+ state . IsLock = isLock ;
393+ }
394+ }
395+
396+ internal bool IsRender ( string ? key ) => Renderer switch
397+ {
398+ DockViewRenderMode . OnlyWhenVisible => GetComponentState ( key ) ? . IsRender ( ) ?? false ,
399+ _ => true
400+ } ;
401+
402+ private DockViewComponentState ? GetComponentState ( string ? key )
383403 {
384404 DockViewComponentState ? state = null ;
385405 if ( Renderer == DockViewRenderMode . OnlyWhenVisible )
@@ -393,12 +413,6 @@ internal void RemoveComponentState(string? key)
393413 return state ;
394414 }
395415
396- internal bool IsRender ( string ? key ) => Renderer switch
397- {
398- DockViewRenderMode . OnlyWhenVisible => GetComponentState ( key ) ? . IsRender ( ) ?? false ,
399- _ => true
400- } ;
401-
402416 private void Dispose ( bool disposing )
403417 {
404418 if ( disposing )
You can’t perform that action at this time.
0 commit comments