← 输入框|github.com|刷新
Skip to content

fix(webapp): retain sidebar item active highlight on nested detail pages - #5097

Closed
Ashik9500 wants to merge 1 commit into
triggerdotdev:mainfrom
Ashik9500:fix/sidebar-navigation-active-state
Closed

Ashik9500 wants to merge 1 commit into
triggerdotdev:mainfrom
Ashik9500:fix/sidebar-navigation-active-state

Conversation

@Ashik9500

Copy link
Copy Markdown

Fixes the issue where sidebar navigation items lost active highlight when navigating from section list pages to nested detail pages (e.g. Tasks and Runs). Supports nestedPaths for Tasks, boundary-safe prefix matching, and preserves dashboard and favorite isolation.

Closes #

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

[Describe the steps you took to test this change]


Changelog

[Short description of what has changed]


Screenshots

[Screenshots]

💯

Fixes the issue where sidebar navigation items lost active highlight when navigating from section list pages to nested detail pages (e.g. Tasks and Runs). Supports nestedPaths for Tasks, boundary-safe prefix matching, and preserves dashboard and favorite isolation.
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@changeset-bot

changeset-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c00e8e4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Hi @Ashik9500, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Nov 4, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

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.

Devin Review found 4 potential issues.

Devin Review

Comment on lines +948 to +951
nestedPaths={[
`${v3EnvironmentPath(organization, project, environment)}/tasks`,
`${v3EnvironmentPath(organization, project, environment)}/agents`,
]}

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.

🟡 Sidebar fix absent from release notes

When this webapp-only sidebar fix ships, users receive no release note for it. The required .server-changes/ entry is missing.

Learn more

The repository requires a .server-changes/ entry for a user-facing fix confined to server apps (release-note rule). This change makes sidebar highlights persist on nested pages, but the PR adds no release note. Customers therefore cannot discover the fix in the release summary.

Example: A user who previously lost the Runs highlight on a run detail page receives the fix, but sees no entry announcing it.

Recommended fix: Add a new .server-changes/ Markdown file with area: webapp, type: fix, and one sentence describing the sidebar behavior for users.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

normalizePath,
} from "~/components/navigation/SideMenuItem";

describe("Sidebar Navigation Route Matching", () => {

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.

🟡 Unit tests lack required exception rationale

When sideMenuNavigation adds unit tests for route-matching helpers, it omits the required one-line comment explaining the exception. The repository's test rules require that rationale for new unit tests.

Learn more

The repository's testing rules permit new unit tests only for complex, stable logic unlikely to change and require a one-line comment explaining the exception (testing rule). This suite tests helpers in isolation but includes no explanation. Its many repetitive cases also make it harder to show why unit-level coverage is necessary here.

Example: A reviewer reaches the new route-matching suite and cannot tell why its pure helper tests qualify for the unit-test exception.

Recommended fix: Prefer a concise integration test of actual sidebar behavior; if the route matcher merits unit tests, add the required one-line explanation and trim redundant cases.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +138 to +142
const resolved =
nested.startsWith("/") && !nested.startsWith(normalizedTarget)
? `${normalizedTarget}${nested}`
: nested;
if (matchesPath(currentPath, resolved, 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.

🔍 Clarify nested path input semantics

The Tasks caller supplies full paths under its target, so they resolve as intended. A full path outside that target instead gets concatenated to it. Define whether nestedPaths accepts relative paths, absolute paths, or both.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +348 to +360
it("highlights Runs on nested run streaming and span subpages", () => {
expect(
isSideMenuItemActive({
currentPath: `${envPath}/runs/run_cm123456789/stream`,
...runsItemConfig,
})
).toBe(true);

expect(
isSideMenuItemActive({
currentPath: `${envPath}/runs/run_cm123456789/spans/span_001`,
...runsItemConfig,
})

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.

🔍 Some route tests use invented subpaths

The run span link uses a span query parameter, not the tested /spans/:id path. The custom dashboard widget subpath also lacks a matching page route. These assertions cover prefix matching rather than those user journeys.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant