File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
pages/browser/components/key-list Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -136,15 +136,21 @@ describe('KeyList', () => {
136
136
/> )
137
137
138
138
await waitFor ( async ( ) => {
139
- expect ( apiServiceMock ) . toBeCalledTimes ( 2 )
139
+ expect ( apiServiceMock ) . toBeCalledTimes ( 3 )
140
140
141
141
expect ( apiServiceMock . mock . calls [ 0 ] ) . toEqual ( [
142
142
'/instance//keys/get-metadata' ,
143
- { keys : [ 'key1' ] } ,
143
+ { keys : [ 'key1' , 'key2' , 'key3' ] } ,
144
144
params ,
145
145
] )
146
146
147
147
expect ( apiServiceMock . mock . calls [ 1 ] ) . toEqual ( [
148
+ '/instance//keys/get-metadata' ,
149
+ { keys : [ 'key1' ] } ,
150
+ params ,
151
+ ] )
152
+
153
+ expect ( apiServiceMock . mock . calls [ 2 ] ) . toEqual ( [
148
154
'/instance//keys/get-metadata' ,
149
155
{ keys : [ 'key1' , 'key2' , 'key3' ] } ,
150
156
params ,
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ const KeyList = forwardRef((props: Props, ref) => {
99
99
useEffect ( ( ) => {
100
100
itemsRef . current = [ ...keysState . keys ]
101
101
if ( itemsRef . current . length === 0 ) {
102
+ rerender ( { } )
102
103
return
103
104
}
104
105
@@ -168,6 +169,7 @@ const KeyList = forwardRef((props: Props, ref) => {
168
169
const newItems = bufferFormatRows ( startIndex , lastIndex )
169
170
170
171
getMetadata ( startIndex , lastIndex , newItems )
172
+ rerender ( { } )
171
173
} , 100 )
172
174
173
175
const bufferFormatRows = ( startIndex : number , lastIndex : number ) : GetKeyInfoResponse [ ] => {
@@ -199,7 +201,8 @@ const KeyList = forwardRef((props: Props, ref) => {
199
201
lastIndex,
200
202
loadedItems,
201
203
isFirstEmpty : ! isSomeNotUndefined ( itemsInit [ 0 ] ) ,
202
- } )
204
+ } ) ,
205
+ ( ) => { rerender ( { } ) }
203
206
) )
204
207
}
205
208
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export const bufferFormatRangeItems = (
4
4
const newItems = [ ]
5
5
if ( lastIndex >= startIndex ) {
6
6
for ( let index = startIndex ; index <= lastIndex ; index ++ ) {
7
- if ( ! items [ index ] ) return [ startIndex , newItems ]
7
+ if ( ! items [ index ] ) return newItems
8
8
newItems . push ( formatItem ( items [ index ] ) )
9
9
}
10
10
}
You can’t perform that action at this time.
0 commit comments