From 265ee02265db3cc6c87727a76075a128da51b17b Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 12 Jun 2025 19:21:59 +1000 Subject: [PATCH] fix: CPU hogging GUI (#2877) --- .github/workflows/ci.yml | 25 +++++++++++++++++++------ ui/desktop/src/components/ChatView.tsx | 5 +++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 982a0beb..98a461af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,8 +45,19 @@ jobs: /usr/local/share/chromium \ /usr/local/share/powershell \ /usr/share/dotnet \ - /usr/share/swift - + /usr/share/swift \ + /opt/ghc \ + /opt/hostedtoolcache \ + /usr/local/graalvm \ + /usr/local/sqlpackage + + # Clean package manager caches + sudo apt-get clean + sudo apt-get autoremove -y + + # Clean docker if present + docker system prune -af 2>/dev/null || true + df -h - name: Checkout Code @@ -98,16 +109,18 @@ jobs: rm -rf target/debug/deps rm -rf target/debug/build rm -rf target/debug/incremental + # Clean cargo cache more aggressively + cargo clean || true # Clean npm cache if it exists - npm cache clean --force || true + npm cache clean --force 2>/dev/null || true # Clean apt cache sudo apt-get clean + sudo apt-get autoremove -y # Remove unnecessary large directories rm -rf ~/.cargo/registry/index || true + rm -rf ~/.cargo/registry/cache || true # Remove docker images if any - docker system prune -af || true - # Remove unused packages - sudo apt-get autoremove -y || true + docker system prune -af 2>/dev/null || true - name: Check disk space after cleanup run: df -h diff --git a/ui/desktop/src/components/ChatView.tsx b/ui/desktop/src/components/ChatView.tsx index 82649d15..222cb994 100644 --- a/ui/desktop/src/components/ChatView.tsx +++ b/ui/desktop/src/components/ChatView.tsx @@ -280,8 +280,9 @@ function ChatContent({ // Update chat messages when they change and save to sessionStorage useEffect(() => { - setChat({ ...chat, messages }); - }, [messages, setChat, chat]); + // @ts-expect-error - TypeScript being overly strict about the return type + setChat((prevChat: ChatType) => ({ ...prevChat, messages })); + }, [messages, setChat]); useEffect(() => { if (messages.length > 0) {