fix(web): preserve deep-link routes when setup is incomplete#136
Merged
Conversation
QA caught: opening /investigations, /services, /scan/runs/:id, or any other route via direct URL load (bookmark, shared link, browser reload) silently redirected to /settings whenever the active stack had no provider. The setup-stage useEffect didn't check the current pane — it pushed every visitor to /settings on initial mount and then back again on every stage transition. Bookmarks, deep links, and 404s broken. Scope the auto-redirect to dashboard origin only: - Extract the decision into a pure helper, autoRouteTargetForSetupStage, paired with the existing shouldResetOnStackSwitch pattern. - The helper returns null whenever the user is already on a non-dashboard route (deep link respected) or on the notfound view (typo'd URLs render the 404 instead of bouncing to /settings). - The setup stepper at the top of every page still surfaces the next step, so first-time onboarding nudge is preserved on /, just not forced on every URL. Tests: - New unit tests cover all six gating clauses (deep route, notfound, complete, dismissed, loading, already-routed-this-stage) plus the two positive paths (needs-provider → settings, needs-discovery → services). - Verified end-to-end in the browser: /investigations, /services, /investigations?severity=high&range=7d, and /xyz-does-not-exist all preserve their URLs on a fresh load with no provider configured. Dashboard / still redirects to /settings (the intended nudge).
WZ
added a commit
that referenced
this pull request
Apr 25, 2026
…01) (#136) QA caught: opening /investigations, /services, /scan/runs/:id, or any other route via direct URL load (bookmark, shared link, browser reload) silently redirected to /settings whenever the active stack had no provider. The setup-stage useEffect didn't check the current pane — it pushed every visitor to /settings on initial mount and then back again on every stage transition. Bookmarks, deep links, and 404s broken. Scope the auto-redirect to dashboard origin only: - Extract the decision into a pure helper, autoRouteTargetForSetupStage, paired with the existing shouldResetOnStackSwitch pattern. - The helper returns null whenever the user is already on a non-dashboard route (deep link respected) or on the notfound view (typo'd URLs render the 404 instead of bouncing to /settings). - The setup stepper at the top of every page still surfaces the next step, so first-time onboarding nudge is preserved on /, just not forced on every URL. Tests: - New unit tests cover all six gating clauses (deep route, notfound, complete, dismissed, loading, already-routed-this-stage) plus the two positive paths (needs-provider → settings, needs-discovery → services). - Verified end-to-end in the browser: /investigations, /services, /investigations?severity=high&range=7d, and /xyz-does-not-exist all preserve their URLs on a fresh load with no provider configured. Dashboard / still redirects to /settings (the intended nudge).
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.
Summary
Closes ISSUE-001 from the QA report on PR #133. Direct URL navigation to any route silently redirected to `/settings` when the active stack had no provider — bookmarks, shared deep links, and 404 fallbacks were broken.
Root cause
The auto-routing `useEffect` in `src/web/App.tsx` (lines 117-129 before this change) ran on every setup-stage transition and pushed the user to `/settings` regardless of where they currently were. There was no check for the current pane.
Fix
Verified end-to-end
Test plan
🤖 Generated with Claude Code