Skip to content

fix: breadcrumb navigation broken after page refresh in bucket browser#97

Merged
cxymds merged 3 commits intomainfrom
copilot/fix-buckets-page-refresh-issue
Apr 10, 2026
Merged

fix: breadcrumb navigation broken after page refresh in bucket browser#97
cxymds merged 3 commits intomainfrom
copilot/fix-buckets-page-refresh-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

Pull Request

Description

After a page refresh inside the bucket browser (e.g. /browser?bucket=notes), clicking "Browser" or "Buckets" breadcrumb links does nothing. The navigation fails because <Link> wrapped in Radix Slot.Root (via BreadcrumbLink asChild) doesn't properly trigger client-side navigation for same-pathname URL changes (only search params differ) in static export mode after hydration.

Fix: add explicit onClick handlers with router.push() to breadcrumb links, bypassing the Link/Slot interaction. This matches the pattern already used in browser/content.tsx.

<Link
  href={item.href}
  onClick={(e) => {
    e.preventDefault()
    if (item.href) router.push(item.href)
  }}
>

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • Security fix

Testing

  • Unit tests added/updated
  • Manual testing completed

No component test infrastructure exists for breadcrumb. Verified via build + lint + type check.

pnpm test:run

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

Screenshots (if applicable)

image

Additional Notes

Single file changed: components/top-nav-breadcrumb.tsx. The Link component is retained (not replaced) so basePath handling, prefetching, and accessibility semantics are preserved.

@overtrue overtrue marked this pull request as ready for review April 9, 2026 13:56
Copilot AI review requested due to automatic review settings April 9, 2026 13:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…-refresh navigation

After a page refresh in the bucket browser, clicking breadcrumb links
("Browser" or "Buckets") failed to navigate because the Next.js Link
component wrapped in Radix Slot.Root did not properly handle same-pathname
navigations (only search params change) in static export mode.

The fix adds explicit onClick handlers with router.push() to breadcrumb
links, ensuring navigation always works regardless of Link component
behavior. This follows the same pattern used in browser/content.tsx.

Agent-Logs-Url: https://github.com/rustfs/console/sessions/8ece92ef-fc2f-4465-a648-5f95fbe189e4

Co-authored-by: overtrue <1472352+overtrue@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14857a94c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +104 to +107
onClick={(e) => {
e.preventDefault()
router.push(item.href!)
}}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve native new-tab behavior for breadcrumb links

The new onClick handler always calls e.preventDefault() and router.push(...), which overrides native link behavior for modified clicks (Cmd/Ctrl-click, Shift-click, middle-click). In the breadcrumb this means users can no longer open an item in a new tab/window, and the current tab navigates unexpectedly instead; this is a functional regression introduced by the change. Consider only intercepting plain left-clicks and letting default browser behavior handle modified clicks.

Useful? React with 👍 / 👎.

Copilot AI changed the title [WIP] Fix issue with redirecting to Buckets after refresh fix: breadcrumb navigation broken after page refresh in bucket browser Apr 9, 2026
Copilot AI requested a review from overtrue April 9, 2026 14:01
@overtrue overtrue requested a review from cxymds April 9, 2026 14:01
@cxymds cxymds merged commit 3550bbd into main Apr 10, 2026
11 checks passed
@cxymds cxymds deleted the copilot/fix-buckets-page-refresh-issue branch April 10, 2026 00:44
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.

[BUG] 在存储桶页面内刷新之后,无法返回到 Buckets 查看所有桶

4 participants