Commit 5577a49 1 parent e89957e commit 5577a49 Copy full SHA for 5577a49
File tree 2 files changed +12
-4
lines changed
packages/fuselage-hooks/src
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,15 @@ export const useBorderBoxSize = (
30
30
}
31
31
32
32
const observer = new ResizeObserver ( ( entries : ResizeObserverEntry [ ] ) => {
33
- if ( entries . length === 0 || entries [ 0 ] . borderBoxSize . length === 0 ) {
33
+ if ( entries . length === 0 ) {
34
34
return ;
35
35
}
36
36
37
- const borderBoxSize = entries [ 0 ] . borderBoxSize [ 0 ] ;
37
+ const borderBoxSize : ResizeObserverSize = Array . isArray (
38
+ entries [ 0 ] . borderBoxSize
39
+ )
40
+ ? entries [ 0 ] . borderBoxSize [ 0 ]
41
+ : entries [ 0 ] . borderBoxSize ;
38
42
39
43
setSizeWithDebounce ( ( prevSize ) => {
40
44
if (
Original file line number Diff line number Diff line change @@ -30,11 +30,15 @@ export const useContentBoxSize = (
30
30
}
31
31
32
32
const observer = new ResizeObserver ( ( entries : ResizeObserverEntry [ ] ) => {
33
- if ( entries . length === 0 || entries [ 0 ] . borderBoxSize . length === 0 ) {
33
+ if ( entries . length === 0 ) {
34
34
return ;
35
35
}
36
36
37
- const contentBoxSize = entries [ 0 ] . contentBoxSize [ 0 ] ;
37
+ const contentBoxSize : ResizeObserverSize = Array . isArray (
38
+ entries [ 0 ] . contentBoxSize
39
+ )
40
+ ? entries [ 0 ] . contentBoxSize [ 0 ]
41
+ : entries [ 0 ] . contentBoxSize ;
38
42
39
43
setSizeWithDebounce ( ( prevSize ) => {
40
44
if (
You can’t perform that action at this time.
0 commit comments