@@ -80,17 +80,20 @@ function StorageNodesComponent({
80
80
viewContext,
81
81
} ) ;
82
82
83
- const [ tableStyle , setTableStyle ] = React . useState < React . CSSProperties > ( { } ) ;
84
-
85
- const handleDataFetched = React . useCallback ( ( data : any ) => {
86
- if ( data ?. columnSettings ) {
87
- const { maxSlotsPerDisk, maxDisksPerNode} = data . columnSettings ;
88
- setTableStyle ( {
89
- [ MAX_SLOTS_CSS_VAR ] : maxSlotsPerDisk ,
90
- [ MAX_DISKS_CSS_VAR ] : maxDisksPerNode ,
91
- } as React . CSSProperties ) ;
92
- }
93
- } , [ ] ) ;
83
+ const [ tableStyle , setTableStyle ] = React . useState < React . CSSProperties | undefined > ( undefined ) ;
84
+
85
+ const handleDataFetched = React . useCallback (
86
+ ( data : PaginatedTableData < PreparedStorageNode > ) => {
87
+ if ( data ?. columnSettings && ! tableStyle ) {
88
+ const { maxSlotsPerDisk, maxDisksPerNode} = data . columnSettings ;
89
+ setTableStyle ( {
90
+ [ MAX_SLOTS_CSS_VAR ] : maxSlotsPerDisk ,
91
+ [ MAX_DISKS_CSS_VAR ] : maxDisksPerNode ,
92
+ } as React . CSSProperties ) ;
93
+ }
94
+ } ,
95
+ [ tableStyle ] ,
96
+ ) ;
94
97
95
98
const renderControls : RenderControls = ( { totalEntities, foundEntities, inited} ) => {
96
99
return (
@@ -245,17 +248,20 @@ function StorageNodesTableGroupContent({
245
248
columns,
246
249
initialEntitiesCount,
247
250
} : StorageNodesTableGroupContentProps ) {
248
- const [ tableStyle , setTableStyle ] = React . useState < React . CSSProperties > ( { } ) ;
249
-
250
- const handleDataFetched = React . useCallback ( ( data : PaginatedTableData < PreparedStorageNode > ) => {
251
- if ( data ?. columnSettings ) {
252
- const { maxSlotsPerDisk, maxDisksPerNode} = data . columnSettings ;
253
- setTableStyle ( {
254
- [ MAX_SLOTS_CSS_VAR ] : maxSlotsPerDisk ,
255
- [ MAX_DISKS_CSS_VAR ] : maxDisksPerNode ,
256
- } as React . CSSProperties ) ;
257
- }
258
- } , [ ] ) ;
251
+ const [ tableStyle , setTableStyle ] = React . useState < React . CSSProperties | undefined > ( undefined ) ;
252
+
253
+ const handleDataFetched = React . useCallback (
254
+ ( data : PaginatedTableData < PreparedStorageNode > ) => {
255
+ if ( data ?. columnSettings && ! tableStyle ) {
256
+ const { maxSlotsPerDisk, maxDisksPerNode} = data . columnSettings ;
257
+ setTableStyle ( {
258
+ [ MAX_SLOTS_CSS_VAR ] : maxSlotsPerDisk ,
259
+ [ MAX_DISKS_CSS_VAR ] : maxDisksPerNode ,
260
+ } as React . CSSProperties ) ;
261
+ }
262
+ } ,
263
+ [ tableStyle ] ,
264
+ ) ;
259
265
260
266
return (
261
267
< PaginatedStorageNodesTable
0 commit comments