diff --git a/src/app/(agent)/agent/edit/page.tsx b/src/app/(agent)/agent/edit/page.tsx index 0310d00..0872a55 100644 --- a/src/app/(agent)/agent/edit/page.tsx +++ b/src/app/(agent)/agent/edit/page.tsx @@ -48,9 +48,7 @@ export default function EditProfilePage() { const repeatableDataRef = useRef>({}); // Dirty (unsaved) field slugs; repeatable sections tracked as `${slug}_entries` const dirtySlugsRef = useRef>(new Set()); - // Server auto-save stays off for APPROVED profiles — their field values are - // live, so changes only go out via the explicit Save button. Local drafts - // still work for everyone. + // Set once the profile loads; guards flushes from firing before then const autoSaveEnabledRef = useRef(false); const draftKeyRef = useRef(null); const autoSaveTimerRef = useRef | null>(null); @@ -233,12 +231,9 @@ export default function EditProfilePage() { return; } - // APPROVED profiles are live — keep their changes behind the explicit - // Save button. Everyone else gets server auto-save while they build. - autoSaveEnabledRef.current = - !profile.verificationStatus || - profile.verificationStatus === 'NONE' || - profile.verificationStatus === 'REJECTED'; + // Auto-save for all statuses. Note: APPROVED profiles are live, so + // auto-saved edits update the public profile immediately. + autoSaveEnabledRef.current = true; draftKeyRef.current = `agent-profile-draft:${profile.userId}`; if (!profile.agentTypeId) { @@ -656,9 +651,7 @@ export default function EditProfilePage() { {autoSaveStatus === 'saved' && lastSavedAt && `All changes saved at ${formatTime(lastSavedAt)}`} {autoSaveStatus === 'error' && 'Auto-save failed — retrying'} {autoSaveStatus === 'dirty' && - (autoSaveEnabledRef.current - ? 'Unsaved changes' - : 'Unsaved changes — remember to save')} + (lastSavedAt ? `Last saved at ${formatTime(lastSavedAt)}` : 'Unsaved changes')} {autoSaveStatus === 'idle' && lastSavedAt && `Last saved at ${formatTime(lastSavedAt)}`} @@ -675,9 +668,7 @@ export default function EditProfilePage() { hour: 'numeric', minute: '2-digit', })} - {autoSaveEnabledRef.current - ? '. Keep editing — your progress is saved automatically.' - : '. Review them and press Save Changes to keep them.'} + . Keep editing — your progress is saved automatically.