Skip to content

Commit b34d1b0

Browse files
ref: put back the options object
1 parent 24b0924 commit b34d1b0

File tree

27 files changed

+33
-27
lines changed

27 files changed

+33
-27
lines changed

static/app/components/charts/chartLegend.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function ChartLegend({items, selected, onSelectionChange}: ChartLegendPro
7272

7373
// ResizeObserver (via useDimensions) updates wrapperWidth on resize,
7474
// which triggers the useLayoutEffect below to recompute overflow.
75-
const {width: wrapperWidth} = useDimensions(wrapperRef);
75+
const {width: wrapperWidth} = useDimensions({elementRef: wrapperRef});
7676
const [firstOverflowIndex, setFirstOverflowIndex] = useState<number | null>(null);
7777

7878
useLayoutEffect(() => {

static/app/components/checkInTimeline/checkInTimeline.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function generateMockTickData(
8282
export default Storybook.story('CheckInTimeline', story => {
8383
story('Simple', () => {
8484
const elementRef = useRef<HTMLDivElement>(null);
85-
const {width: timelineWidth} = useDimensions(elementRef);
85+
const {width: timelineWidth} = useDimensions({elementRef});
8686
const timeWindowConfig = useTimeWindowConfig({timelineWidth});
8787

8888
const [secondsGap, setSecondsGap] = useState(60);

static/app/components/contentSliderDiff/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface Props {
3131
*/
3232
function Body({onDragHandleMouseDown, after, before, minHeight = '0px'}: Props) {
3333
const positionedRef = useRef<HTMLDivElement>(null);
34-
const viewDimensions = useDimensions(positionedRef);
34+
const viewDimensions = useDimensions({elementRef: positionedRef});
3535

3636
return (
3737
<OverflowVisibleContainer>

static/app/components/feedback/feedbackItem/feedbackItemHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function dimensionsToSize({width}: Dimensions) {
3535

3636
export function FeedbackItemHeader({eventData, feedbackItem, onBackToList}: Props) {
3737
const wrapperRef = useRef<HTMLDivElement>(null);
38-
const dimensions = useDimensions(wrapperRef);
38+
const dimensions = useDimensions({elementRef: wrapperRef});
3939

4040
return (
4141
<VerticalSpacing ref={wrapperRef}>

static/app/components/replays/breadcrumbs/replayTimeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function ReplayTimeline() {
2323
const [timelineScale] = useTimelineScale();
2424

2525
const stackedRef = useRef<HTMLDivElement>(null);
26-
const {width} = useDimensions(stackedRef);
26+
const {width} = useDimensions({elementRef: stackedRef});
2727

2828
if (!replay) {
2929
return <Placeholder height="20px" />;

static/app/components/replays/player/replayPlayerMeasurer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const MAX_ZOOM = 1.5;
4848

4949
export function ReplayPlayerMeasurer({children, measure = 'both'}: Props) {
5050
const elementRef = useRef<HTMLDivElement>(null);
51-
const measuredDimensions = useDimensions(elementRef);
51+
const measuredDimensions = useDimensions({elementRef});
5252
const playerState = useReplayPlayerState();
5353
const [, setViewSize] = useReplayPlayerSize();
5454

static/app/components/searchQueryBuilder/context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export function SearchQueryBuilderProvider({
241241
searchSource,
242242
onSearch,
243243
});
244-
const {width: searchBarWidth} = useDimensions(wrapperRef);
244+
const {width: searchBarWidth} = useDimensions({elementRef: wrapperRef});
245245
const size =
246246
searchBarWidth && searchBarWidth < 600 ? ('small' as const) : ('normal' as const);
247247

static/app/components/searchQueryBuilder/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ function SearchQueryBuilderUI({
280280
dispatch({type: 'UPDATE_QUERY', query: initialQuery});
281281
}, [dispatch, initialQuery]);
282282

283-
const {width: actionBarWidth} = useDimensions(actionBarRef);
283+
const {width: actionBarWidth} = useDimensions({elementRef: actionBarRef});
284284

285285
return (
286286
<Wrapper

static/app/utils/useDimensions.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import type {RefObject} from 'react';
22
import {useCallback, useLayoutEffect, useState} from 'react';
33
import {useResizeObserver} from '@react-aria/utils';
44

5+
interface Props {
6+
elementRef: RefObject<Element | null>;
7+
}
8+
59
/**
610
* Returns a ref to be added to an element and returns the dimensions of that element
711
*/
8-
export function useDimensions(elementRef: RefObject<HTMLElement | null>) {
12+
export function useDimensions({elementRef}: Props) {
913
const [dimensions, setDimensions] = useState({height: 0, width: 0});
1014

1115
const element = elementRef.current;

static/app/views/alerts/rules/uptime/detailsTimeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface Props {
2626
export function DetailsTimeline({uptimeDetector, onStatsLoaded}: Props) {
2727
const {id} = uptimeDetector;
2828
const elementRef = useRef<HTMLDivElement>(null);
29-
const {width: containerWidth} = useDimensions(elementRef);
29+
const {width: containerWidth} = useDimensions({elementRef});
3030
const timelineWidth = useDebouncedValue(containerWidth, 500);
3131

3232
const timeWindowConfig = useTimeWindowConfig({

0 commit comments

Comments
 (0)