diff --git a/src/components/BoardManager.tsx b/src/components/BoardManager.tsx index e802e00..34d48d3 100644 --- a/src/components/BoardManager.tsx +++ b/src/components/BoardManager.tsx @@ -15,7 +15,7 @@ import { Typography, message, } from "antd" -import { DeleteOutlined, EditOutlined, PlayCircleOutlined, PlusOutlined, ReloadOutlined } from "@ant-design/icons" +import { DeleteOutlined, EditOutlined, PlusOutlined, ReloadOutlined } from "@ant-design/icons" import { useTranslation } from "react-i18next" type BoardStudentViewMode = "list" | "card" | "grid" @@ -511,6 +511,18 @@ ORDER BY reward_points DESC, score DESC`, [runListQuery] ) + const listConfigSignature = useMemo(() => { + if (!activeBoard) return "" + return JSON.stringify( + activeBoard.lists.map((item) => ({ + id: item.id, + name: item.name, + sql: item.sql, + viewMode: item.viewMode, + })) + ) + }, [activeBoard]) + useEffect(() => { fetchBoards() }, [fetchBoards]) @@ -530,8 +542,11 @@ ORDER BY reward_points DESC, score DESC`, useEffect(() => { if (!activeBoard) return - runAllInBoard(activeBoard).catch(() => void 0) - }, [activeBoardId]) + const timer = window.setTimeout(() => { + runAllInBoard(activeBoard).catch(() => void 0) + }, 260) + return () => window.clearTimeout(timer) + }, [activeBoard?.id, listConfigSignature, runAllInBoard]) useEffect(() => { const onDataUpdated = (e: Event) => { @@ -924,9 +939,6 @@ ORDER BY reward_points DESC, score DESC`, title={{list.name}} extra={ - @@ -1049,6 +1061,15 @@ ORDER BY reward_points DESC, score DESC`, + activeBoard && removeBoard(activeBoard.id)} + disabled={!canManage || !activeBoard} + > + + @@ -1058,8 +1079,6 @@ ORDER BY reward_points DESC, score DESC`, - - - - - removeBoard(activeBoard.id)} disabled={!canManage}> - - - {saving && {t("board.saving")}} - + {saving && {t("board.saving")}} {renderBoardWorkspace()}