Skip to content

fix(issue-views): Fix buggy dragging #86264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions static/app/components/nav/issueViews/issueViewNavItemContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ export interface IssueViewNavItemContentProps {
* Whether the item is active.
*/
isActive: boolean;
/**
* Whether an item is being dragged.
*/
isDragging: boolean;
/**
* Whether the item is the last view in the list.
* This will be removed once view sharing/starring is implemented.
*/
isLastView: boolean;
/**
* A callback function that updates the isDragging state.
*/
setIsDragging: (isDragging: boolean) => void;
/**
* A callback function that updates the view with new params.
*/
Expand All @@ -62,7 +70,6 @@ export interface IssueViewNavItemContentProps {
*/
sectionRef?: React.RefObject<HTMLDivElement>;
}

export function IssueViewNavItemContent({
view,
sectionRef,
Expand All @@ -71,14 +78,15 @@ export function IssueViewNavItemContent({
deleteView,
duplicateView,
isLastView,
isDragging,
setIsDragging,
}: IssueViewNavItemContentProps) {
const organization = useOrganization();
const location = useLocation();
const navigate = useNavigate();

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

const {projects} = useProjects();

Expand Down Expand Up @@ -130,8 +138,13 @@ export function IssueViewNavItemContent({
setIsDragging(false);
endInteraction();
}}
layoutId={`${view.id}`}
style={{
originY: '0px',
...(isDragging
? {}
: {
originY: '0px',
}),
}}
>
<StyledSecondaryNavItem
Expand Down
3 changes: 3 additions & 0 deletions static/app/components/nav/issueViews/issueViewNavItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function IssueViewNavItems({
const queryParams = location.query;

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

// If the `viewId` (from `/issues/views/:viewId`) is not found in the views array,
// then redirect to the "All Issues" page
Expand Down Expand Up @@ -225,6 +226,8 @@ export function IssueViewNavItems({
view={view}
sectionRef={sectionRef}
isActive={view.id === viewId}
isDragging={isDragging}
setIsDragging={setIsDragging}
updateView={updatedView => handleUpdateView(view, updatedView)}
deleteView={() => handleDeleteView(view)}
duplicateView={() => handleDuplicateView(view)}
Expand Down
Loading