karmada-io / dashboard

Web UI for Karmada
Apache License 2.0
49 stars 42 forks source link

fix: new method for generate breadcrumbs #82

Closed warjiang closed 2 months ago

warjiang commented 2 months ago

What type of PR is this? /kind bug

What this PR does / why we need it: When we introduce the i18n feature for dashboard, it would cause the empty breadcrumbs. Comparison as following: before: image

after: image

The reason is that useMatches only load once, and after that, even if the global route object refreshed, the useMatches hooks will not return the latest matches object. https://github.com/karmada-io/dashboard/blob/650ef60ee15a29576702c45d518826d00bf23b59/ui/apps/dashboard/src/components/panel/index.tsx#L21 What I do is to traverse the global route object again, and get the sidebarName from the matched route entry.

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

- fix the empty breadcrumbs.
warjiang commented 2 months ago

/assign @RainbowMango @samzong

karmada-bot commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/karmada-io/dashboard/blob/main/OWNERS)~~ [RainbowMango] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment