Skip to content

Commit 7ecf208

Browse files
committed
Revert "#4020 only track max height"
This reverts commit 3ba3efc.
1 parent 3ba3efc commit 7ecf208

2 files changed

Lines changed: 8 additions & 7 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: TaskStatus;
23+
status: Task['status'];
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: (height: number) => void;
31+
onHeightChange: (status: Task['status'], 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(droppableBox.scrollHeight);
103+
onHeightChange(status, droppableBox.scrollHeight);
104104
});
105105
observer.observe(droppableBox);
106106
return () => observer.disconnect();

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

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

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

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

2930
const onDeleteTask = (taskId: string) => {
@@ -134,7 +135,7 @@ export const TaskListContent = ({ project }: TaskListProps) => {
134135
tasks={tasksByStatus[status]}
135136
key={status}
136137
project={project}
137-
equalizedHeight={maxColHeight}
138+
equalizedHeight={equalizedHeight}
138139
isDragging={isDragging}
139140
/>
140141
))}

0 commit comments

Comments
 (0)