Skip to content

Commit abb0b2e

Browse files
authored
fix(structure): do not set history inspector height to 0 (#8421)
1 parent 1ebb974 commit abb0b2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/sanity/src/structure/panes/document/inspectors/changes/HistorySelector.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ export function HistorySelector({showList}: {showList: boolean}) {
2020
const [listHeight, setListHeight] = useState(0)
2121

2222
const getScrollerRef = useCallback((el: HTMLDivElement | null) => {
23+
if (!el?.clientHeight) return
2324
/**
2425
* Hacky solution, the list height needs to be defined, it cannot be obtained from the parent using a `max-height: 100%`
2526
* Because the scroller won't work properly and it won't scroll to the selected element on mount.
2627
* To fix this, this component will set the list height to the height of the parent element - 1px, to avoid a double scroll line.
2728
*/
28-
setListHeight(el?.clientHeight ? el.clientHeight - 1 : 0)
29+
setListHeight(el.clientHeight - 1)
2930
setScrollRef(el)
3031
}, [])
3132

0 commit comments

Comments
 (0)