Redirect to root page after project deletion#72
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 callingnavigate('/')immediately followed bywindow.location.reload(). Also added aif (!project) return nullguard so the settings pane can't crash onproject.idif the project disappears fromprojectsMapwhile it is still mounted.ui/src/Dashboard/Dashboard.jsx: theselectedproject state is now cleared when theprojectquery 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:
#/(root) instantly after confirming deletion