fix: move hooks before early return in BoardView, remove unused attachmentMode prop
Fixed React hooks rules violation where useState and useCallback were called after a conditional return in BoardView. Removed unused attachmentMode prop from AttachmentSection (can be re-added when file dialog is wired up).
This commit is contained in:
@@ -230,24 +230,6 @@ export function BoardView() {
|
||||
[board, moveCard, moveColumn]
|
||||
);
|
||||
|
||||
if (!board) {
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center text-pylon-text-secondary">
|
||||
<span className="font-mono text-sm">Loading board...</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Get the active item for the drag overlay
|
||||
const activeCard =
|
||||
activeType === "card" && activeId ? board.cards[activeId] : null;
|
||||
const activeColumn =
|
||||
activeType === "column" && activeId
|
||||
? board.columns.find((c) => c.id === activeId)
|
||||
: null;
|
||||
|
||||
const columnIds = board.columns.map((c) => c.id);
|
||||
|
||||
const [announcement, setAnnouncement] = useState("");
|
||||
|
||||
const handleDragEndWithAnnouncement = useCallback(
|
||||
@@ -275,6 +257,24 @@ export function BoardView() {
|
||||
[handleDragEnd, board]
|
||||
);
|
||||
|
||||
if (!board) {
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center text-pylon-text-secondary">
|
||||
<span className="font-mono text-sm">Loading board...</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Get the active item for the drag overlay
|
||||
const activeCard =
|
||||
activeType === "card" && activeId ? board.cards[activeId] : null;
|
||||
const activeColumn =
|
||||
activeType === "column" && activeId
|
||||
? board.columns.find((c) => c.id === activeId)
|
||||
: null;
|
||||
|
||||
const columnIds = board.columns.map((c) => c.id);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Visually hidden live region for drag-and-drop announcements */}
|
||||
|
||||
Reference in New Issue
Block a user