Problem
The Delete confirmation dialog in the editor can never be confirmed for an entity that has zero cross-references — the safe, common case. The Delete button stays disabled and the only way out is Cancel.
Root cause
DeleteImpactAnalysis pushes the gate state upward from a mount effect:
// components/editor/DeleteImpactAnalysis.tsx
useEffect(() => {
...
setIsLoading(true);
setAcknowledged(false);
onAcknowledge(false); // ← parent's gate goes false on every open
...
qualityApi.getCrossReferences(...).then(setData)...
}, [entityIri, projectId, accessToken, branch]);
The parent gates on that flag directly:
// app/projects/[id]/editor/page.tsx
const [deleteImpactAcknowledged, setDeleteImpactAcknowledged] = useState(true);
...
confirmDisabled={!deleteImpactAcknowledged}
ConfirmDialog renders its children inside DialogContent, so they mount each time the dialog opens. The effect therefore fires and sets the flag to false. The only thing that ever sets it back to true is the acknowledgement checkbox — and when total === 0 the component returns null before rendering any checkbox. Nothing re-enables the button.
Reproduction
- Open a project in the editor.
- Right-click a class that nothing else references, choose Delete.
- The dialog shows no impact warning (correct — there are no references), but Delete is greyed out.
Confirmed with a probe against current dev: after the query resolves with total: 0, onAcknowledge has been called exactly once, with false, and never again.
ZERO-REF onAcknowledge calls: [ [ false ] ]
Expected
With no references, the impact panel stays hidden and Delete is enabled immediately.
Fix
Being fixed as part of #200 Category A cleanup — see PR referenced below. The gate is derived in the editor page from the same useCrossReferences query the panel renders (React Query dedupes the two observers onto one fetch), so it engages only while the check is pending, when it errored, or when references were actually found. DeleteImpactAnalysis reports acknowledgement solely from the checkbox.
Note on the error case
The pending and error paths keep today's behaviour — Delete stays disabled. On error the panel says "Failed to check references. Proceed with caution", which reads like it should let the user through, but no checkbox is offered. Left as-is rather than changed silently; worth a separate decision.
Done criteria
Problem
The Delete confirmation dialog in the editor can never be confirmed for an entity that has zero cross-references — the safe, common case. The Delete button stays disabled and the only way out is Cancel.
Root cause
DeleteImpactAnalysispushes the gate state upward from a mount effect:The parent gates on that flag directly:
ConfirmDialogrenders its children insideDialogContent, so they mount each time the dialog opens. The effect therefore fires and sets the flag tofalse. The only thing that ever sets it back totrueis the acknowledgement checkbox — and whentotal === 0the component returnsnullbefore rendering any checkbox. Nothing re-enables the button.Reproduction
Confirmed with a probe against current
dev: after the query resolves withtotal: 0,onAcknowledgehas been called exactly once, withfalse, and never again.Expected
With no references, the impact panel stays hidden and Delete is enabled immediately.
Fix
Being fixed as part of #200 Category A cleanup — see PR referenced below. The gate is derived in the editor page from the same
useCrossReferencesquery the panel renders (React Query dedupes the two observers onto one fetch), so it engages only while the check is pending, when it errored, or when references were actually found.DeleteImpactAnalysisreports acknowledgement solely from the checkbox.Note on the error case
The pending and error paths keep today's behaviour — Delete stays disabled. On error the panel says "Failed to check references. Proceed with caution", which reads like it should let the user through, but no checkbox is offered. Left as-is rather than changed silently; worth a separate decision.
Done criteria