You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Admin settings: guard client-side navigation away from a dirty section #515
Follow-up from #514 (admin navigation restructure).
What happens now. Settings sections that moved onto feature pages (/admin/rewind/settings, /admin/discord/settings, /admin/ai/settings, /admin/request-limits) keep a reload/close prompt through useLeaveGuard (hooks/use-leave-guard.ts), but beforeunload does not fire on client-side navigation. Switching a section tab or a sidebar item while a section is in edit mode with unsaved changes unmounts it and the draft is gone, with no prompt. On the old one-page Settings, moving between sections kept drafts, because nothing unmounted.
Where it bites most. The Rewind settings form is large; one tap on Season or Playground mid-edit loses it. The time-zone note inside that form no longer links while editing (fixed in #514), but every tab and sidebar link is still a live exit.
Possible shapes.
Intercept Link clicks inside the admin shell while any useLeaveGuard(true) is registered (a small context: sections register their dirty state; SectionTabs, the sidebar and the tab bar ask before navigating, with a ConfirmDialog).
Or keep the draft across navigation (persist the form state per section id in sessionStorage, restore on return). Covers reload too, but is more state to reason about.
Next 16 has no router-level blocking API, so either way it is an app-level guard.
Scope note. The same guard would cover the Settings page's own sections (switching sidebar items while dirty), which main already dropped silently; the restructure made the exit one tab away instead of one sidebar item away.
Activity