Fix amendment: no version bump on edit, stays on current version

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Krao Hasanee
2026-03-27 00:13:42 -04:00
parent 585cb154ba
commit f4a1b7c25e
+6 -8
View File
@@ -93,12 +93,10 @@ export default function RequestDetail() {
setSaving(true); setSaving(true);
if (action === 'edit') { if (action === 'edit') {
const newVersion = (task.current_version || 0) + 1; // No version bump — amendment notes attach to the current version
await supabase.from('tasks').update({ current_version: newVersion }).eq('id', id);
const { data: newSub } = await supabase.from('submissions').insert({ const { data: newSub } = await supabase.from('submissions').insert({
task_id: id, task_id: id,
version_number: newVersion + 1, version_number: (task.current_version || 0) + 1,
type: 'amendment', type: 'amendment',
service_type: task.title, service_type: task.title,
deadline: revisionForm.deadline || null, deadline: revisionForm.deadline || null,
@@ -118,8 +116,6 @@ export default function RequestDetail() {
} }
} }
} }
setTask(t => ({ ...t, current_version: newVersion }));
} else { } else {
const newVersion = (task.current_version || 0) + 1; const newVersion = (task.current_version || 0) + 1;
await supabase.from('tasks').update({ status: 'not_started', current_version: newVersion }).eq('id', id); await supabase.from('tasks').update({ status: 'not_started', current_version: newVersion }).eq('id', id);
@@ -188,7 +184,7 @@ export default function RequestDetail() {
const titleWithVersion = `${task.title} ${vLabel(task.current_version)}`; const titleWithVersion = `${task.title} ${vLabel(task.current_version)}`;
const formTitle = action === 'edit' const formTitle = action === 'edit'
? `Edit Request — will become ${vLabel((task.current_version || 0) + 1)}` ? `Amend Request — ${vLabel(task.current_version || 0)}`
: action === 'reopen' : action === 'reopen'
? `Request New Revision — will become ${vLabel((task.current_version || 0) + 1)}` ? `Request New Revision — will become ${vLabel((task.current_version || 0) + 1)}`
: `Request a Revision — will become ${vLabel((task.current_version || 0) + 1)}`; : `Request a Revision — will become ${vLabel((task.current_version || 0) + 1)}`;
@@ -320,7 +316,9 @@ export default function RequestDetail() {
)} )}
<div className="version-header"> <div className="version-header">
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
<div className="version-number">{vLabel(sub.version_number - 1)}</div> {sub.type !== 'amendment' && (
<div className="version-number">{vLabel(sub.version_number - 1)}</div>
)}
<StatusBadge status={sub.type} /> <StatusBadge status={sub.type} />
</div> </div>
<div style={{ fontSize: 12, color: 'var(--text-secondary)' }}> <div style={{ fontSize: 12, color: 'var(--text-secondary)' }}>