@@ -223,21 +223,23 @@ export default class BrowserCell extends Component {
223
223
?. catch ( err => console . log ( err ) ) ;
224
224
}
225
225
if ( this . props . current ) {
226
- const node = this . cellRef . current ;
227
- const { setRelation } = this . props ;
228
- const { left, right, bottom, top } = node . getBoundingClientRect ( ) ;
229
-
230
- // Takes into consideration Sidebar width when over 980px wide.
231
- // If setRelation is undefined, DataBrowser is used as ObjectPicker, so it does not have a sidebar.
232
- const leftBoundary = window . innerWidth > 980 && setRelation ? 300 : 0 ;
233
-
234
- // BrowserToolbar + DataBrowserHeader height
235
- const topBoundary = 126 ;
236
-
237
- if ( left < leftBoundary || right > window . innerWidth ) {
238
- node . scrollIntoView ( { block : 'nearest' , inline : 'start' } ) ;
239
- } else if ( top < topBoundary || bottom > window . innerHeight ) {
240
- node . scrollIntoView ( { block : 'nearest' , inline : 'nearest' } ) ;
226
+ if ( prevProps . selectedCells === this . props . selectedCells ) {
227
+ const node = this . cellRef . current ;
228
+ const { setRelation } = this . props ;
229
+ const { left, right, bottom, top } = node . getBoundingClientRect ( ) ;
230
+
231
+ // Takes into consideration Sidebar width when over 980px wide.
232
+ // If setRelation is undefined, DataBrowser is used as ObjectPicker, so it does not have a sidebar.
233
+ const leftBoundary = window . innerWidth > 980 && setRelation ? 300 : 0 ;
234
+
235
+ // BrowserToolbar + DataBrowserHeader height
236
+ const topBoundary = 126 ;
237
+
238
+ if ( left < leftBoundary || right > window . innerWidth ) {
239
+ node . scrollIntoView ( { block : 'nearest' , inline : 'start' } ) ;
240
+ } else if ( top < topBoundary || bottom > window . innerHeight ) {
241
+ node . scrollIntoView ( { block : 'nearest' , inline : 'nearest' } ) ;
242
+ }
241
243
}
242
244
243
245
if ( ! this . props . hidden ) {
0 commit comments