Skip to content

Commit a78c265

Browse files
committed
Fix HistorySidebar useEffect dependency causing excessive API calls
1 parent 6e41d2d commit a78c265

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/components/HistorySidebar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function HistorySidebar() {
6767
useEffect(() => {
6868
if (!chatStore) return;
6969
fetchGroupedHistoryTasks(setHistoryTasks);
70-
}, [chatStore?.updateCount, chatStore]);
70+
}, [chatStore?.updateCount]);
7171

7272
// Group ongoing tasks by project
7373
const ongoingProjects = useMemo(() => {

src/pages/Home.tsx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { Inbox, LayoutGrid, Plus, RefreshCw, Zap, ZapOff } from 'lucide-react';
4141
import Overview from './Project/Triggers';
4242

4343
import BottomBar from '@/components/BottomBar';
44-
import BrowserAgentWorkspace from '@/components/BrowserAgentWorkspace';
44+
import BrowserAgentWorkspace from '@/components/BrowserAgentWorkSpace';
4545
import TerminalAgentWorkspace from '@/components/TerminalAgentWorkspace';
4646
import { Popover, PopoverContent } from '@/components/ui/popover';
4747
import {
@@ -393,7 +393,7 @@ export default function Home() {
393393
return (
394394
<div className="flex h-full w-full flex-1 items-center justify-center">
395395
<div className="relative flex h-full w-full flex-col">
396-
<div className="inset-0 rounded-xl pointer-events-none absolute bg-transparent"></div>
396+
<div className="pointer-events-none absolute inset-0 rounded-xl bg-transparent"></div>
397397
<div className="relative z-10 h-full w-full">
398398
<Workflow taskAssigning={[]} />
399399
</div>
@@ -407,15 +407,15 @@ export default function Home() {
407407
{activeTask.taskAssigning?.find(
408408
(agent) => agent.agent_id === activeWorkSpace
409409
)?.type === 'browser_agent' && (
410-
<div className="animate-in fade-in-0 slide-in-from-right-2 flex h-full w-full flex-1 duration-300">
410+
<div className="flex h-full w-full flex-1 duration-300 animate-in fade-in-0 slide-in-from-right-2">
411411
<BrowserAgentWorkspace />
412412
</div>
413413
)}
414414
{activeWorkSpace === 'workflow' && (
415415
<div className="flex h-full w-full flex-1 items-center justify-center">
416416
<div className="relative flex h-full w-full flex-col">
417417
{/*filter blur */}
418-
<div className="inset-0 rounded-xl pointer-events-none absolute bg-transparent"></div>
418+
<div className="pointer-events-none absolute inset-0 rounded-xl bg-transparent"></div>
419419
<div className="relative z-10 h-full w-full">
420420
<Workflow taskAssigning={activeTask.taskAssigning || []} />
421421
</div>
@@ -434,7 +434,7 @@ export default function Home() {
434434
<div className="flex h-full w-full flex-1 items-center justify-center">
435435
<div className="relative flex h-full w-full flex-col">
436436
{/*filter blur */}
437-
<div className="blur-bg inset-0 rounded-xl bg-surface-secondary pointer-events-none absolute"></div>
437+
<div className="blur-bg pointer-events-none absolute inset-0 rounded-xl bg-surface-secondary"></div>
438438
<div className="relative z-10 h-full w-full">
439439
<Folder />
440440
</div>
@@ -447,7 +447,7 @@ export default function Home() {
447447
<div className="flex h-full w-full flex-1 items-center justify-center">
448448
<div className="relative flex h-full w-full flex-col">
449449
{/*filter blur */}
450-
<div className="blur-bg inset-0 rounded-xl bg-surface-secondary pointer-events-none absolute"></div>
450+
<div className="blur-bg pointer-events-none absolute inset-0 rounded-xl bg-surface-secondary"></div>
451451
<div className="relative z-10 h-full w-full">
452452
<Folder
453453
data={activeTask.taskAssigning?.find(
@@ -463,7 +463,7 @@ export default function Home() {
463463
<div className="flex h-full w-full flex-1 items-center justify-center">
464464
<div className="relative flex h-full w-full flex-col">
465465
{/*filter blur */}
466-
<div className="blur-bg inset-0 rounded-xl bg-surface-secondary pointer-events-none absolute"></div>
466+
<div className="blur-bg pointer-events-none absolute inset-0 rounded-xl bg-surface-secondary"></div>
467467
<div className="relative z-10 h-full w-full">
468468
<Folder />
469469
</div>
@@ -478,12 +478,12 @@ export default function Home() {
478478
// Render Tasks tab content (default)
479479
return (
480480
<ReactFlowProvider>
481-
<div className="min-h-0 px-2 pb-2 pt-10 flex h-full flex-row overflow-hidden">
482-
<div className="min-h-0 min-w-0 gap-4 relative flex h-full flex-1 items-center justify-center overflow-hidden">
481+
<div className="flex h-full min-h-0 flex-row overflow-hidden px-2 pb-2 pt-10">
482+
<div className="relative flex h-full min-h-0 min-w-0 flex-1 items-center justify-center gap-4 overflow-hidden">
483483
<ResizablePanelGroup
484484
direction="horizontal"
485485
key={`${isChatBoxVisible}-${chatPanelPosition}`}
486-
className="gap-0.5 w-full items-center justify-center"
486+
className="w-full items-center justify-center gap-0.5"
487487
>
488488
{/* ChatBox Panel - Left side */}
489489
{isChatBoxVisible && chatPanelPosition === 'left' && (
@@ -504,10 +504,10 @@ export default function Home() {
504504
<ResizablePanel className="h-full w-full min-w-[600px]">
505505
{chatStore.activeTaskId &&
506506
chatStore.tasks[chatStore.activeTaskId]?.activeWorkspace ? (
507-
<div className="rounded-2xl border-border-tertiary bg-surface-secondary flex h-full w-full flex-col border-solid">
507+
<div className="flex h-full w-full flex-col rounded-2xl border-solid border-border-tertiary bg-surface-secondary">
508508
{/* Header with workspace tabs */}
509-
<div className="px-2 py-2 flex w-full items-center justify-between">
510-
<div className="gap-4 flex w-full flex-row items-center justify-start">
509+
<div className="flex w-full items-center justify-between px-2 py-2">
510+
<div className="flex w-full flex-row items-center justify-start gap-4">
511511
<MenuToggleGroup
512512
type="single"
513513
variant="info"
@@ -538,7 +538,7 @@ export default function Home() {
538538
icon={<Inbox />}
539539
showSubIcon={unviewedTabs.has('inbox')}
540540
subIcon={
541-
<span className="h-2 w-2 bg-red-500 rounded-full" />
541+
<span className="h-2 w-2 rounded-full bg-red-500" />
542542
}
543543
className="w-32"
544544
>
@@ -553,14 +553,14 @@ export default function Home() {
553553
}
554554
showSubIcon={unviewedTabs.has('triggers')}
555555
subIcon={
556-
<span className="h-2 w-2 bg-text-error rounded-full" />
556+
<span className="h-2 w-2 rounded-full bg-text-error" />
557557
}
558558
className="w-32"
559559
rightElement={
560560
wsConnectionStatus !== 'connected' && (
561561
<Popover>
562562
<PopoverPrimitive.Trigger asChild>
563-
<div className="h-6 w-6 rounded-md hover:bg-surface-tertiary flex cursor-pointer items-center justify-center transition-colors">
563+
<div className="flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-surface-tertiary">
564564
<RefreshCw
565565
className={`h-3 w-3 ${wsConnectionStatus === 'connecting' ? 'animate-spin' : ''}`}
566566
/>
@@ -571,7 +571,7 @@ export default function Home() {
571571
side="bottom"
572572
align="end"
573573
>
574-
<div className="gap-3 flex flex-col">
574+
<div className="flex flex-col gap-3">
575575
<p className="text-body-sm text-text-body">
576576
Reconnect to trigger listener
577577
</p>
@@ -596,12 +596,12 @@ export default function Home() {
596596
</MenuToggleItem>
597597
</MenuToggleGroup>
598598
</div>
599-
<div className="gap-2 flex items-center">
599+
<div className="flex items-center gap-2">
600600
{activeWorkspaceTab !== 'inbox' && (
601601
<Button
602602
variant="primary"
603603
size="sm"
604-
className="w-24 rounded-lg items-center justify-center"
604+
className="w-24 items-center justify-center rounded-lg"
605605
onClick={() => {
606606
if (activeWorkspaceTab === 'workforce') {
607607
setAddWorkerDialogOpen(true);
@@ -664,10 +664,10 @@ export default function Home() {
664664
</div>
665665
) : (
666666
// Show default workspace when activeTaskId is null or task doesn't exist
667-
<div className="rounded-2xl border-border-tertiary bg-surface-secondary flex h-full w-full flex-col border-solid">
667+
<div className="flex h-full w-full flex-col rounded-2xl border-solid border-border-tertiary bg-surface-secondary">
668668
{/* Header with workspace tabs */}
669-
<div className="px-2 py-2 flex w-full items-center justify-between">
670-
<div className="gap-4 flex w-full flex-row items-center justify-start">
669+
<div className="flex w-full items-center justify-between px-2 py-2">
670+
<div className="flex w-full flex-row items-center justify-start gap-4">
671671
<MenuToggleGroup
672672
type="single"
673673
variant="info"
@@ -698,7 +698,7 @@ export default function Home() {
698698
icon={<Inbox />}
699699
showSubIcon={unviewedTabs.has('inbox')}
700700
subIcon={
701-
<span className="h-2 w-2 bg-red-500 rounded-full" />
701+
<span className="h-2 w-2 rounded-full bg-red-500" />
702702
}
703703
className="w-32"
704704
>
@@ -713,14 +713,14 @@ export default function Home() {
713713
}
714714
showSubIcon={unviewedTabs.has('triggers')}
715715
subIcon={
716-
<span className="h-2 w-2 bg-red-500 rounded-full" />
716+
<span className="h-2 w-2 rounded-full bg-red-500" />
717717
}
718718
className="w-32"
719719
rightElement={
720720
wsConnectionStatus !== 'connected' && (
721721
<Popover>
722722
<PopoverPrimitive.Trigger asChild>
723-
<div className="h-6 w-6 rounded-md hover:bg-surface-tertiary flex cursor-pointer items-center justify-center transition-colors">
723+
<div className="flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-surface-tertiary">
724724
<RefreshCw
725725
className={`h-3 w-3 ${wsConnectionStatus === 'connecting' ? 'animate-spin' : ''}`}
726726
/>
@@ -731,7 +731,7 @@ export default function Home() {
731731
side="bottom"
732732
align="end"
733733
>
734-
<div className="gap-3 flex flex-col">
734+
<div className="flex flex-col gap-3">
735735
<p className="text-sm text-text-body">
736736
Reconnect to trigger listener
737737
</p>
@@ -756,7 +756,7 @@ export default function Home() {
756756
</MenuToggleItem>
757757
</MenuToggleGroup>
758758
</div>
759-
<div className="gap-2 flex items-center">
759+
<div className="flex items-center gap-2">
760760
{activeWorkspaceTab !== 'inbox' && (
761761
<Button
762762
variant="primary"

src/pages/Project/Workspace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
1414

1515
import BottomBar from '@/components/BottomBar';
16-
import BrowserAgentWorkspace from '@/components/BrowserAgentWorkspace';
16+
import BrowserAgentWorkspace from '@/components/BrowserAgentWorkSpace';
1717
import ChatBox from '@/components/ChatBox';
1818
import Folder from '@/components/Folder';
1919
import TerminalAgentWorkspace from '@/components/TerminalAgentWorkspace';

0 commit comments

Comments
 (0)