Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const EmployeeApp = ({ path, stateCode, userType, tenants }) => {
{
internalLink: `/${window?.contextPath}/employee/pgr/inbox-v2`,
content: t("PGR_INBOX"),
show: location.pathname.includes("inbox"),
show: location.pathname.includes("inbox") || location.pathname.includes("complaint-details"),
},
Comment on lines 55 to 58
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Prefer route-aware matching (matchPath) over substring includes

Using includes on pathname can produce false positives and is brittle if routes evolve (e.g., inbox-v3 or localized paths). Suggest matching against the configured route patterns using react-router’s matchPath and the existing base path prop for consistency.

Apply this diff within the current segment to delegate to a named boolean:

-                show: location.pathname.includes("inbox") || location.pathname.includes("complaint-details"),
+                show: showInboxCrumb,

Add the following supporting changes elsewhere in this file:

  • Import:
import { matchPath } from "react-router-dom";
  • Compute the booleans (place after useLocation and before the return):
const showInboxCrumb = Boolean(
  matchPath(location.pathname, { path: `${path}/inbox-v2`, exact: false }) ||
  matchPath(location.pathname, { path: `${path}/complaint-details/:id`, exact: false })
);

{
internalLink: `/${window?.contextPath}/employee/pgr/complaint-details`,
Expand Down
Loading