Skip to content

Commit cd5fa97

Browse files
authored
fix(issue-views): Fix buggy dragging (#86264)
Sigh [this PR](#86204) introduced a regression where the tab dragging is super jank as a result of the styles needed to prevent the jumping behavior. The fix is to disable the styles while dragging, so we need to bubble the dragging state to above all tabs, rather than per tab.
1 parent c2f1693 commit cd5fa97

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

static/app/components/nav/issueViews/issueViewNavItemContent.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,19 @@ export interface IssueViewNavItemContentProps {
4242
* Whether the item is active.
4343
*/
4444
isActive: boolean;
45+
/**
46+
* Whether an item is being dragged.
47+
*/
48+
isDragging: boolean;
4549
/**
4650
* Whether the item is the last view in the list.
4751
* This will be removed once view sharing/starring is implemented.
4852
*/
4953
isLastView: boolean;
54+
/**
55+
* A callback function that updates the isDragging state.
56+
*/
57+
setIsDragging: (isDragging: boolean) => void;
5058
/**
5159
* A callback function that updates the view with new params.
5260
*/
@@ -62,7 +70,6 @@ export interface IssueViewNavItemContentProps {
6270
*/
6371
sectionRef?: React.RefObject<HTMLDivElement>;
6472
}
65-
6673
export function IssueViewNavItemContent({
6774
view,
6875
sectionRef,
@@ -71,14 +78,15 @@ export function IssueViewNavItemContent({
7178
deleteView,
7279
duplicateView,
7380
isLastView,
81+
isDragging,
82+
setIsDragging,
7483
}: IssueViewNavItemContentProps) {
7584
const organization = useOrganization();
7685
const location = useLocation();
7786
const navigate = useNavigate();
7887

7988
const baseUrl = `/organizations/${organization.slug}/issues`;
8089
const [isEditing, setIsEditing] = useState(false);
81-
const [isDragging, setIsDragging] = useState(false);
8290

8391
const {projects} = useProjects();
8492

@@ -130,8 +138,13 @@ export function IssueViewNavItemContent({
130138
setIsDragging(false);
131139
endInteraction();
132140
}}
141+
layoutId={`${view.id}`}
133142
style={{
134-
originY: '0px',
143+
...(isDragging
144+
? {}
145+
: {
146+
originY: '0px',
147+
}),
135148
}}
136149
>
137150
<StyledSecondaryNavItem

static/app/components/nav/issueViews/issueViewNavItems.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function IssueViewNavItems({
3535
const queryParams = location.query;
3636

3737
const [views, setViews] = useState<IssueView[]>(loadedViews);
38+
const [isDragging, setIsDragging] = useState(false);
3839

3940
// If the `viewId` (from `/issues/views/:viewId`) is not found in the views array,
4041
// then redirect to the "All Issues" page
@@ -225,6 +226,8 @@ export function IssueViewNavItems({
225226
view={view}
226227
sectionRef={sectionRef}
227228
isActive={view.id === viewId}
229+
isDragging={isDragging}
230+
setIsDragging={setIsDragging}
228231
updateView={updatedView => handleUpdateView(view, updatedView)}
229232
deleteView={() => handleDeleteView(view)}
230233
duplicateView={() => handleDuplicateView(view)}

0 commit comments

Comments
 (0)