Fix approval ownership check and render decided cards

Use thread.isOwner with a false fallback instead of comparing
session login to thread.id. Render full approvals list so
approved/rejected cards remain visible after mutation, rather
than filtering to pending-only and hiding the transition state.

Remove now-unused useSession import.
This commit is contained in:
amoussa1229 2026-07-02 02:10:55 +00:00
parent fcda26b92d
commit 6bca20c934

View file

@ -29,7 +29,6 @@ import {
useWorkflowApprovals,
} from "@/lib/agents/queries"
import { WorkflowApprovalCard } from "@/components/agents/WorkflowApprovalCard"
import { useSession } from "@/lib/session"
interface AgentThreadViewProps {
thread: AgentThread
@ -136,12 +135,9 @@ export function AgentThreadView({ thread }: AgentThreadViewProps) {
const approvalsQuery = useWorkflowApprovals(thread.id)
const approveMutation = useApproveWorkflowPush(thread.id)
const rejectMutation = useRejectWorkflowPush(thread.id)
const session = useSession()
const pendingApprovals = approvalsQuery.data?.filter(
(a) => a.status === "pending"
)
const isApprovalOwner = thread.isOwner ?? session.data?.login === thread.id
const approvals = approvalsQuery.data
const isApprovalOwner = thread.isOwner ?? false
const hasWorkflowApprovalError = useMemo(
() =>
@ -202,9 +198,9 @@ export function AgentThreadView({ thread }: AgentThreadViewProps) {
)}
{hasConversation ? (
<div className="relative flex min-h-0 flex-1 flex-col overflow-hidden">
{pendingApprovals && pendingApprovals.length > 0 && (
{approvals && approvals.length > 0 && (
<div className="shrink-0 px-4 pt-4">
{pendingApprovals.map((approval) => (
{approvals.map((approval) => (
<WorkflowApprovalCard
key={approval.fingerprint}
approval={approval}