fix(butler): runtime fixes — SQLite mode=rwc + React hooks ordering
Some checks failed
CI / Build Frontend (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Build Frontend (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- Add ?mode=rwc to pain.db SQLite URL so it creates the file on first run - Move useUIModeStore hook before conditional returns in App.tsx to fix React "Rendered more hooks than during the previous render" error
This commit is contained in:
@@ -165,7 +165,7 @@ pub fn run() {
|
|||||||
std::fs::create_dir_all(&pain_db_dir).expect("Failed to create intelligence dir");
|
std::fs::create_dir_all(&pain_db_dir).expect("Failed to create intelligence dir");
|
||||||
|
|
||||||
let db_path = pain_db_dir.join("pain.db");
|
let db_path = pain_db_dir.join("pain.db");
|
||||||
let db_url = format!("sqlite:{}", db_path.display());
|
let db_url = format!("sqlite:{}?mode=rwc", db_path.display());
|
||||||
let pool = rt.block_on(sqlx::SqlitePool::connect(&db_url))
|
let pool = rt.block_on(sqlx::SqlitePool::connect(&db_url))
|
||||||
.expect("Failed to connect pain storage SQLite pool");
|
.expect("Failed to connect pain storage SQLite pool");
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import type { Clone } from './store/agentStore';
|
|||||||
import { createLogger } from './lib/logger';
|
import { createLogger } from './lib/logger';
|
||||||
import { startOfflineMonitor } from './store/offlineStore';
|
import { startOfflineMonitor } from './store/offlineStore';
|
||||||
import { useUIModeStore } from './store/uiModeStore';
|
import { useUIModeStore } from './store/uiModeStore';
|
||||||
import { SimpleTopBar } from './components/SimpleTopBar';
|
import { SimpleSidebar } from './components/SimpleSidebar';
|
||||||
|
|
||||||
const log = createLogger('App');
|
const log = createLogger('App');
|
||||||
|
|
||||||
@@ -65,6 +65,7 @@ function App() {
|
|||||||
const loadHands = useHandStore((s) => s.loadHands);
|
const loadHands = useHandStore((s) => s.loadHands);
|
||||||
const { setCurrentAgent } = useChatStore();
|
const { setCurrentAgent } = useChatStore();
|
||||||
const { isNeeded: onboardingNeeded, isLoading: onboardingLoading, markCompleted } = useOnboarding();
|
const { isNeeded: onboardingNeeded, isLoading: onboardingLoading, markCompleted } = useOnboarding();
|
||||||
|
const uiMode = useUIModeStore((s) => s.mode);
|
||||||
|
|
||||||
// Proposal notifications
|
// Proposal notifications
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
@@ -445,17 +446,30 @@ function App() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uiMode = useUIModeStore((s) => s.mode);
|
// Simple mode: sidebar + chat + detail drawer (Trae Solo style)
|
||||||
|
|
||||||
// Simple mode: single-column layout with top bar only
|
|
||||||
if (uiMode === 'simple') {
|
if (uiMode === 'simple') {
|
||||||
return (
|
return (
|
||||||
<div className="h-screen flex flex-col overflow-hidden text-gray-800 text-sm bg-white dark:bg-gray-950">
|
<div className="h-screen flex overflow-hidden text-gray-800 text-sm bg-white dark:bg-gray-950">
|
||||||
<SimpleTopBar onToggleMode={() => useUIModeStore.getState().setMode('professional')} />
|
{/* 简洁侧边栏: 对话 + 行业资讯 */}
|
||||||
<div className="flex-1 min-h-0">
|
<SimpleSidebar
|
||||||
<ChatArea compact />
|
onOpenSettings={() => setView('settings')}
|
||||||
|
onToggleMode={() => useUIModeStore.getState().setMode('professional')}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* 主聊天区域 */}
|
||||||
|
<div className="flex-1 flex flex-col overflow-hidden">
|
||||||
|
<ChatArea compact onOpenDetail={() => setShowDetailDrawer(true)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 详情抽屉 - 简洁模式仅 状态/Agent/管家 */}
|
||||||
|
<DetailDrawer
|
||||||
|
open={showDetailDrawer}
|
||||||
|
onClose={() => setShowDetailDrawer(false)}
|
||||||
|
title="详情"
|
||||||
|
>
|
||||||
|
<RightPanel simpleMode />
|
||||||
|
</DetailDrawer>
|
||||||
|
|
||||||
{/* Hand Approval Modal (global) */}
|
{/* Hand Approval Modal (global) */}
|
||||||
<HandApprovalModal
|
<HandApprovalModal
|
||||||
handRun={pendingApprovalRun}
|
handRun={pendingApprovalRun}
|
||||||
|
|||||||
Reference in New Issue
Block a user