Skip to content

fix(router): keep search and notifications in history when opening a result - #603

Merged
netchampfaris merged 1 commit into
frappe:developfrom
Jeesha09:fix/back-history-from-search-and-notifications
Oct 5, 2026
Merged

netchampfaris merged 1 commit into
frappe:developfrom
Jeesha09:fix/back-history-from-search-and-notifications

Conversation

@Jeesha09

@Jeesha09 Jeesha09 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

Opening a result from Search or a Notification and pressing Back skipped the Search/Notifications page and went to whatever was open before it.

Cause

Search results and notifications link to a discussion without its slug. The canonical-route guard (getCanonicalContentRoute in router.ts) resolves the slug and redirects with replace: true. When a guard redirects with replace: true, vue-router applies it to the whole navigation, so the user's click became a replace and the Search/Notifications history entry was overwritten.

Fix

Only force replace: true for deep links (first load, refresh, pasted URL), where the non-canonical URL shouldn't stay in history. In-app clicks keep their own push/replace behaviour, so the redirect adds the slug without dropping the previous page.

…result

Links from search results and notifications carry no slug, so the canonical
route guard redirected them with replace: true. vue-router then turned the
whole click into a replace, dropping the Search or Notifications entry, and
Back skipped past it. Only replace on deep links; in-app clicks stay a push.
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Changes how the router handles navigation history.

The change appears safe to merge, with a non-blocking request for history regression coverage.

Reviews (1) · Last reviewed commit: "fix(router): keep search and notificatio..."

Comment thread frontend/src/router.ts
query: to.query,
hash: to.hash,
replace: true,
...(isInAppNavigation ? {} : { replace: true }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 History behavior lacks coverage. The redirect now depends on whether navigation began in the app, but no test covers that distinction. Please test that Back returns to Search or Notifications after opening a slugless result, and that a cold-load canonical redirect replaces its URL. Without those checks, either history behavior could regress unnoticed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/router.ts
Line: 939

Comment:
**History behavior lacks coverage.** The redirect now depends on whether navigation began in the app, but no test covers that distinction. Please test that Back returns to Search or Notifications after opening a slugless result, and that a cold-load canonical redirect replaces its URL. Without those checks, either history behavior could regress unnoticed.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@netchampfaris
netchampfaris merged commit 861c78b into frappe:develop Oct 5, 2026
10 checks passed
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.

2 participants