fix: Auto-dismiss conflict panel and re-check mergeability on completion
Instead of showing a manual "Re-check Mergeability" button after the conflict agent finishes, auto-dismiss the agent and trigger mergeability re-check immediately when the state transitions to completed.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Loader2, AlertCircle, GitMerge, CheckCircle2, ChevronDown, ChevronRight, Terminal } from 'lucide-react';
|
import { Loader2, AlertCircle, GitMerge, CheckCircle2, ChevronDown, ChevronRight, Terminal } from 'lucide-react';
|
||||||
import { useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { QuestionForm } from '@/components/QuestionForm';
|
import { QuestionForm } from '@/components/QuestionForm';
|
||||||
import { useConflictAgent } from '@/hooks/useConflictAgent';
|
import { useConflictAgent } from '@/hooks/useConflictAgent';
|
||||||
@@ -13,6 +13,17 @@ interface ConflictResolutionPanelProps {
|
|||||||
export function ConflictResolutionPanel({ initiativeId, conflicts, onResolved }: ConflictResolutionPanelProps) {
|
export function ConflictResolutionPanel({ initiativeId, conflicts, onResolved }: ConflictResolutionPanelProps) {
|
||||||
const { state, agent, questions, spawn, resume, stop, dismiss } = useConflictAgent(initiativeId);
|
const { state, agent, questions, spawn, resume, stop, dismiss } = useConflictAgent(initiativeId);
|
||||||
const [showManual, setShowManual] = useState(false);
|
const [showManual, setShowManual] = useState(false);
|
||||||
|
const prevStateRef = useRef(state);
|
||||||
|
|
||||||
|
// Auto-dismiss and re-check mergeability when conflict agent completes
|
||||||
|
useEffect(() => {
|
||||||
|
const prev = prevStateRef.current;
|
||||||
|
prevStateRef.current = state;
|
||||||
|
if (prev !== 'completed' && state === 'completed') {
|
||||||
|
dismiss();
|
||||||
|
onResolved();
|
||||||
|
}
|
||||||
|
}, [state, dismiss, onResolved]);
|
||||||
|
|
||||||
if (state === 'none') {
|
if (state === 'none') {
|
||||||
return (
|
return (
|
||||||
@@ -117,26 +128,13 @@ git commit --no-edit`}
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state === 'completed') {
|
if (state === 'completed') {
|
||||||
|
// Auto-dismiss effect above handles this — show brief success message during transition
|
||||||
return (
|
return (
|
||||||
<div className="mx-4 mt-3 rounded-lg border border-status-success-border bg-status-success-bg/50 px-4 py-3">
|
<div className="mx-4 mt-3 rounded-lg border border-status-success-border bg-status-success-bg/50 px-4 py-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center gap-2">
|
||||||
<div className="flex items-center gap-2">
|
<CheckCircle2 className="h-3.5 w-3.5 text-status-success-fg" />
|
||||||
<CheckCircle2 className="h-3.5 w-3.5 text-status-success-fg" />
|
<span className="text-sm text-status-success-fg">Conflicts resolved — re-checking mergeability...</span>
|
||||||
<span className="text-sm text-status-success-fg">Conflicts resolved</span>
|
<Loader2 className="h-3 w-3 animate-spin text-status-success-fg" />
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => {
|
|
||||||
dismiss();
|
|
||||||
onResolved();
|
|
||||||
}}
|
|
||||||
className="h-7 text-xs"
|
|
||||||
>
|
|
||||||
Re-check Mergeability
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user