Skip to content

Redirect to root page after project deletion#72

Merged
kindermax merged 1 commit into
mainfrom
claude/exciting-aryabhata-6a15fa
Jun 12, 2026
Merged

Redirect to root page after project deletion#72
kindermax merged 1 commit into
mainfrom
claude/exciting-aryabhata-6a15fa

Conversation

@kindermax

Copy link
Copy Markdown
Contributor

Fixes #61

What changed

  • ui/src/Dashboard/Settings.jsx: on successful project deletion the UI now navigates to the root page immediately and refreshes the projects list through Apollo (refetchQueries: [PROJECTS_QUERY]), replacing the old flow of waiting 2 seconds and then calling navigate('/') immediately followed by window.location.reload(). Also added a if (!project) return null guard so the settings pane can't crash on project.id if the project disappears from projectsMap while it is still mounted.
  • ui/src/Dashboard/Dashboard.jsx: the selected project state is now cleared when the project query param is removed from the URL, so the deleted project doesn't linger as a stale selection on the root page (also fixes back-button behavior).
  • CHANGELOG.md: entry under Unreleased → Fixed.

Why

The old navigate('/') + window.location.reload() combo raced the hash update against a full page reload behind a 2-second timer, which could leave the user on the stale settings page of the deleted project instead of the root page. A plain SPA navigation plus a cache refetch removes the race, the reload jank and the dead 2-second wait entirely.

How it was verified

Ran the full stack locally (postgres + LDAP + web via docker compose, projects seeded via SQL) and exercised the real deletion flow in a browser against both the vite dev server and the production bundle served by the backend:

  • URL goes to #/ (root) instantly after confirming deletion
  • the "Project … removed successfully" toast stays visible on the root page
  • the sidebar updates in place with no page reload (verified via a JS marker surviving the navigation)
  • no new console errors

Fixes #61

The previous implementation waited 2 seconds after a successful
deletion and then called navigate('/') immediately followed by
window.location.reload(), which raced the hash update against the
reload and left the user on the stale settings page.

Now the redirect happens right away as a regular SPA navigation:
the projects list is refreshed through Apollo refetchQueries instead
of a full page reload, the Dashboard clears the selected project when
the project query param is gone, and SettingsContainer guards against
rendering a project that no longer exists in the projects map.
@kindermax
kindermax merged commit 4f4b65f into main Jun 12, 2026
1 check passed
@kindermax
kindermax deleted the claude/exciting-aryabhata-6a15fa branch June 12, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirect to root page after project deletion

1 participant