Skip to content

Commit 3ba3efc

Browse files
committed
#4020 only track max height
1 parent 4d08824 commit 3ba3efc

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/v2/TaskColumn.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ export const TaskColumn = ({
2020
onAddTask,
2121
onHeightChange
2222
}: {
23-
status: Task['status'];
23+
status: TaskStatus;
2424
tasks: TaskWithIndex[];
2525
project: Project;
2626
equalizedHeight: number;
2727
isDragging: boolean;
2828
onEditTask: (task: Task) => void;
2929
onDeleteTask: (taskId: string) => void;
3030
onAddTask: (task: Task) => void;
31-
onHeightChange: (status: Task['status'], height: number) => void;
31+
onHeightChange: (height: number) => void;
3232
}) => {
3333
const { mutateAsync: createTask } = useCreateTask();
3434
const [showCreateTaskModal, setShowCreateTaskModal] = useState(false);
@@ -100,7 +100,7 @@ export const TaskColumn = ({
100100
if (!droppableBox) return;
101101

102102
const observer = new ResizeObserver(() => {
103-
onHeightChange(status, droppableBox.scrollHeight);
103+
onHeightChange(droppableBox.scrollHeight);
104104
});
105105
observer.observe(droppableBox);
106106
return () => observer.disconnect();

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/v2/TaskListContent.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ export const TaskListContent = ({ project }: TaskListProps) => {
2020
const toast = useToast();
2121

2222
const [isDragging, setIsDragging] = useState(false);
23-
const [columnHeights, setColumnHeights] = useState<Partial<Record<Task['status'], number>>>({});
24-
const equalizedHeight = Math.max(...(Object.values(columnHeights) as number[]));
23+
const [maxColHeight, setMaxColumnHeight] = useState(0);
2524

26-
const onHeightChange = useCallback((status: Task['status'], height: number) => {
27-
setColumnHeights((prev) => ({ ...prev, [status]: height }));
25+
const onHeightChange = useCallback((height: number) => {
26+
setMaxColumnHeight((prev) => Math.max(height, prev));
2827
}, []);
2928

3029
const onDeleteTask = (taskId: string) => {
@@ -135,7 +134,7 @@ export const TaskListContent = ({ project }: TaskListProps) => {
135134
tasks={tasksByStatus[status]}
136135
key={status}
137136
project={project}
138-
equalizedHeight={equalizedHeight}
137+
equalizedHeight={maxColHeight}
139138
isDragging={isDragging}
140139
/>
141140
))}

0 commit comments

Comments
 (0)