Skip to content

Commit d0b0da8

Browse files
committed
fix(issues): Open drawers with navigate, preserve scroll
Fixes an issue where we navigated to /activity/ on open but then replaced it on close which makes it confusing to use the back button because activity does not reopen. fixes #89368
1 parent 4d61904 commit d0b0da8

File tree

7 files changed

+13
-5
lines changed

7 files changed

+13
-5
lines changed

static/app/components/core/button/index.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ export interface BaseButtonProps extends CommonButtonProps, ElementProps<ButtonE
117117
* @deprecated Use LinkButton instead
118118
*/
119119
href?: string;
120+
/**
121+
* @deprecated Use LinkButton instead
122+
*/
123+
preventScrollReset?: boolean;
120124
/**
121125
* @deprecated Use LinkButton instead
122126
*/
@@ -153,6 +157,7 @@ interface ToLinkButtonProps extends BaseLinkButtonProps {
153157
*/
154158
to: string | LocationDescriptor;
155159
external?: never;
160+
preventScrollReset?: boolean;
156161
replace?: boolean;
157162
}
158163

@@ -203,6 +208,7 @@ function BaseButton({
203208
size = 'md',
204209
to,
205210
replace,
211+
preventScrollReset,
206212
busy,
207213
href,
208214
title,
@@ -291,6 +297,7 @@ function BaseButton({
291297
to={disabled ? undefined : to}
292298
href={disabled ? undefined : href}
293299
replace={replace}
300+
preventScrollReset={preventScrollReset}
294301
size={size}
295302
priority={priority}
296303
borderless={borderless}

static/app/utils/useNavigate.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {locationDescriptorToTo} from './reactRouter6Compat/location';
88
import {useTestRouteContext} from './useRouteContext';
99

1010
type NavigateOptions = {
11+
preventScrollReset?: boolean;
1112
replace?: boolean;
1213
state?: any;
1314
};

static/app/views/issueDetails/streamline/hooks/useIssueActivityDrawer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function useIssueActivityDrawer({group, project}: UseIssueActivityDrawerP
3434
filter: undefined,
3535
},
3636
},
37-
{replace: true}
37+
{preventScrollReset: true}
3838
);
3939
},
4040
shouldCloseOnLocationChange: newLocation => {

static/app/views/issueDetails/streamline/hooks/useMergedIssuesDrawer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function useMergedIssuesDrawer({
3535
cursor: undefined,
3636
},
3737
},
38-
{replace: true}
38+
{preventScrollReset: true}
3939
);
4040
},
4141
});

static/app/views/issueDetails/streamline/hooks/useSimilarIssuesDrawer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function useSimilarIssuesDrawer({
3535
cursor: undefined,
3636
},
3737
},
38-
{replace: true}
38+
{preventScrollReset: true}
3939
);
4040
},
4141
});

static/app/views/issueDetails/streamline/sidebar/viewButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {space} from 'sentry/styles/space';
55

66
export function ViewButton({children, ...props}: LinkButtonProps) {
77
return (
8-
<TextButton borderless size="zero" {...props}>
8+
<TextButton borderless size="zero" preventScrollReset {...props}>
99
{children}
1010
</TextButton>
1111
);

static/app/views/issueDetails/useGroupDistributionsDrawer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function useGroupDistributionsDrawer({
4646
flagDrawerCursor: undefined,
4747
},
4848
},
49-
{replace: true}
49+
{preventScrollReset: true}
5050
);
5151
},
5252
shouldCloseOnLocationChange: newLocation => {

0 commit comments

Comments
 (0)