fix: scope all git, activity, webhook, and summarize-title routes to correct project store

- Fix 30 git routes to use getScopedStore(req) instead of global store
- Fix activity GET/DELETE routes to use scoped store
- Fix POST /api/github/webhooks to use scoped store for badge updates
- Fix POST /api/ai/summarize-title to use scoped store for settings
- Fix GET /api/git/worktrees to use scoped store for task listing
- Add projectId parameter to all git and activity frontend API functions
- Update useActivityLog hook to pass projectId through

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
gsxdsm
2026-04-12 17:55:07 -07:00
parent 860d3c29fe
commit 9d2f61501b
9 changed files with 500 additions and 129 deletions

View File

@@ -1,6 +1,7 @@
import { memo, useCallback, useMemo, useState } from "react";
import { Activity, Server, Settings, Trash2 } from "lucide-react";
import type { NodeInfo, ProjectInfo } from "../api";
import { getProjectCountForNode } from "../utils/nodeProjectAssignment";
export interface NodeCardProps {
node: NodeInfo;
@@ -23,10 +24,6 @@ function truncateUrl(url: string, maxLength: number = 42): string {
return `${url.slice(0, maxLength - 3)}...`;
}
function getAssignedProjectCount(projects: ProjectInfo[], nodeId: string): number {
return projects.filter((project) => project.nodeId === nodeId).length;
}
function areNodeCardPropsEqual(previous: NodeCardProps, next: NodeCardProps): boolean {
const prevNode = previous.node;
const nextNode = next.node;
@@ -40,8 +37,9 @@ function areNodeCardPropsEqual(previous: NodeCardProps, next: NodeCardProps): bo
if (prevNode.updatedAt !== nextNode.updatedAt) return false;
if (previous.isLoading !== next.isLoading) return false;
const previousCount = getAssignedProjectCount(previous.projects, prevNode.id);
const nextCount = getAssignedProjectCount(next.projects, nextNode.id);
// Compare project counts using the canonical counting function
const previousCount = getProjectCountForNode(previous.projects, prevNode);
const nextCount = getProjectCountForNode(next.projects, nextNode);
return previousCount === nextCount;
}
@@ -57,8 +55,8 @@ function NodeCardInner({
const statusConfig = STATUS_CONFIG[node.status];
const assignedProjectCount = useMemo(() => {
return getAssignedProjectCount(projects, node.id);
}, [projects, node.id]);
return getProjectCountForNode(projects, node);
}, [projects, node]);
const handleOpenDetails = useCallback(() => {
onEdit(node);