Skip to content

Review: Remove sidebar in review mode to avoid complex layout state management - #35329

Closed
ghengeveld wants to merge 16 commits into
nextfrom
review-sidebar-layout
Closed

ghengeveld wants to merge 16 commits into
nextfrom
review-sidebar-layout

Conversation

@ghengeveld

@ghengeveld ghengeveld commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

What I did

Review mode no longer collapses or restores sidebar/panel visibility when entering or leaving a review; it still snapshots and restores sidebar filters only.

On the review summary page and on story routes with a collection query param, the sidebar is not rendered (including the mobile menu drawer), sidebar keyboard shortcuts (toggleNav, focusNav, search) are ignored, and the toolbar “Show sidebar” control is hidden. The review toolbar header on story canvases only renders when collection is present.

The fixed-position review summary portal no longer reserves left nav width on review routes, so the summary fills the full width when the sidebar is suppressed.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Run the internal Storybook UI (cd code && yarn storybook:ui).
  2. Trigger or open a review summary (?path=/review/).
  3. Confirm the summary is full width with no empty gutter where the sidebar would be, and that the sidebar (desktop) / navigation menu (mobile) is not shown.
  4. Open a reviewed story (collection query param present): confirm no sidebar, no review toolbar header on normal stories without collection, review header visible with collection, and no “Show sidebar” toolbar button.
  5. Enter and exit review mode and confirm sidebar/panel visibility matches what you had before entering; only sidebar filters should change during review.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-35329-sha-ec096ee6. Try it out in a new sandbox by running npx storybook@0.0.0-pr-35329-sha-ec096ee6 sandbox or in an existing project with npx storybook@0.0.0-pr-35329-sha-ec096ee6 upgrade.

More information
Published version 0.0.0-pr-35329-sha-ec096ee6
Triggered by @ghengeveld
Repository storybookjs/storybook
Branch review-sidebar-layout
Commit ec096ee6
Datetime Tue Jun 30 11:26:06 UTC 2026 (1782818766)
Workflow run 28440764779

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=35329

Summary by CodeRabbit

  • New Features
    • Review-collection routes (story + review query param) are now recognized to tailor toolbar/menu visibility and navigation behavior.
  • Bug Fixes
    • Sidebar and navigation shortcuts are blocked on review-manager views to prevent unintended focus/search/toggles.
    • Sidebar/chrome insets, fullscreen toolbar visibility, and mobile navigation menu rendering now adapt to review-manager layout; mobile menu can be programmatically hidden.
    • Review mode and leaving-review flows are filter-focused, with refined auto-accept/notification behavior, improved route-aware notification handling, and a navigation-in-flight guard to prevent premature re-entry.
  • Tests
    • Updated/added stories and test coverage for route detection, filter restoration, notification dismissal, and review navigation edge cases.

Review entry and exit now only snapshot and restore sidebar filters; entering a review no longer collapses or restores nav/panel layout state.
The review route no longer renders the sidebar (desktop or mobile menu), and sidebar keyboard shortcuts are ignored there.
Curated review story URLs suppress sidebar rendering and sidebar shortcuts, hide the toolbar show-sidebar control, and gate the review toolbar header on the collection query param.
The fixed-position summary overlay no longer reserves nav width on review routes, matching the layout grid when the sidebar is hidden.
@ghengeveld
ghengeveld requested a review from yannbf June 30, 2026 10:21
@ghengeveld ghengeveld self-assigned this Jun 30, 2026
@ghengeveld ghengeveld added ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release. maintenance User-facing maintenance tasks labels Jun 30, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx (1)

146-164: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Close the mobile menu when showMenu turns off.

Unmounting MobileMenuDrawer here leaves isMobileMenuOpen untouched. If the drawer is open before entering a review route, navigating back will remount it already open.

Possible fix
+  useEffect(() => {
+    if (!showMenu && isMobileMenuOpen) {
+      setMobileMenuOpen(false);
+    }
+  }, [showMenu, isMobileMenuOpen, setMobileMenuOpen]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx`
around lines 146 - 164, The MobileMenuDrawer in MobileNavigation is unmounted
when showMenu becomes false, but the open state in useLayout remains true, so it
can remount already open later. Update the MobileNavigation component to watch
showMenu and call setMobileMenuOpen(false) whenever showMenu turns off, using
the existing useLayout state helpers so the drawer state is reset consistently.
code/core/src/manager/components/layout/Layout.stories.tsx (1)

514-518: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Mock the review route in this story.

Line 515 only changes managerLayoutState.viewMode, but Layout now hides the menu from useStorybookState().path/customQueryParams. Without stubbing a /review/... route or a /story/... route with the review collection query param, Line 518 is asserting against ambient manager state instead of the new contract. As per coding guidelines, "When writing component stories, mock external context (for example ManagerContext.Provider) inside story decorators or beforeEach."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/core/src/manager/components/layout/Layout.stories.tsx` around lines 514
- 518, The story is only setting managerLayoutState.viewMode, but Layout now
derives the menu visibility from useStorybookState().path and customQueryParams,
so the assertion is relying on ambient manager state. Update the Layout story to
explicitly mock the review route context via a story decorator or beforeEach,
using either a /review/... path or a /story/... path with the review collection
query param, and keep the play assertion in sync with that mocked route state.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@code/core/src/manager-api/modules/shortcuts.ts`:
- Around line 276-280: Blocked sidebar shortcuts should exit before calling
preventDefault() so review-route keypresses are ignored instead of swallowed. In
the shortcuts handling logic around isSidebarShortcutBlocked, move the
blocked-route check ahead of the event.preventDefault() call and return
immediately for focusNav, search, and toggleNav when sidebar shortcuts are
blocked. Apply the same early-return pattern in the other affected shortcut
branches so no preventDefault() runs for blocked sidebar shortcuts.

In `@code/core/src/manager/components/review/review-mode.ts`:
- Around line 54-58: Move the REVIEW_MODE_SESSION_KEY write in enterReviewMode
so it happens only after api.setAllTagFilters and api.setAllStatusFilters both
complete successfully. Keep the existing FILTERS_SNAPSHOT_SESSION_KEY
persistence before the awaited calls if needed, but do not mark review mode
active until the setters resolve. Use enterReviewMode and the
sessionStore.write(REVIEW_MODE_SESSION_KEY, ...) call as the key locations to
update.

---

Outside diff comments:
In `@code/core/src/manager/components/layout/Layout.stories.tsx`:
- Around line 514-518: The story is only setting managerLayoutState.viewMode,
but Layout now derives the menu visibility from useStorybookState().path and
customQueryParams, so the assertion is relying on ambient manager state. Update
the Layout story to explicitly mock the review route context via a story
decorator or beforeEach, using either a /review/... path or a /story/... path
with the review collection query param, and keep the play assertion in sync with
that mocked route state.

In `@code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx`:
- Around line 146-164: The MobileMenuDrawer in MobileNavigation is unmounted
when showMenu becomes false, but the open state in useLayout remains true, so it
can remount already open later. Update the MobileNavigation component to watch
showMenu and call setMobileMenuOpen(false) whenever showMenu turns off, using
the existing useLayout state helpers so the drawer state is reset consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 30702a94-1d60-4555-8eca-ad46b0de5995

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd8598 and dd37865.

📒 Files selected for processing (11)
  • code/core/src/manager-api/modules/shortcuts.ts
  • code/core/src/manager/components/layout/Layout.stories.tsx
  • code/core/src/manager/components/layout/Layout.tsx
  • code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
  • code/core/src/manager/components/preview/Preview.tsx
  • code/core/src/manager/components/preview/tools/menu.tsx
  • code/core/src/manager/components/review/review-actions.ts
  • code/core/src/manager/components/review/review-mode.test.ts
  • code/core/src/manager/components/review/review-mode.ts
  • code/core/src/manager/components/review/screens/ReviewSummaryPortal.tsx
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx
💤 Files with no reviewable changes (1)
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx

Comment thread code/core/src/manager-api/modules/shortcuts.ts Outdated
Comment thread code/core/src/manager/components/review/review-mode.ts Outdated
@storybook-app-bot

storybook-app-bot Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Package Benchmarks

Commit: 34d3be7, ran on 30 June 2026 at 22:25:04 UTC

No significant changes detected, all good. 👏

@ghengeveld ghengeveld changed the title Review: stop mutating layout chrome and hide sidebar on review routes Review: Remove sidebar in review mode to avoid complex layout state management Jun 30, 2026
Auto-accept now runs before the in-review arrival skip, so opening the summary or a collection story marks the matching createdAt as visited and clears the sidebar toast without a click.
Layout and other callers can render before router state is initialized; treat a missing path as a non-review route.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cceff594-d73b-47c2-aa96-d1ec2a600e42

📥 Commits

Reviewing files that changed from the base of the PR and between cb63c84 and 34d3be7.

📒 Files selected for processing (1)
  • code/core/src/manager/components/layout/Layout.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/core/src/manager/components/layout/Layout.stories.tsx

📝 Walkthrough

Walkthrough

Review route matching now accepts undefined paths. Review mode stores filters only, leaving review-dismiss navigation async with visit tracking and exit-session guarding. Sidebar, mobile menu, shortcuts, preview toolbar, and inset behavior now depend on review-route and collection query state.

Changes

Review Route and Chrome Visibility

Layer / File(s) Summary
Review route matching
code/core/src/shared/review/routes.ts, code/core/src/shared/review/routes.test.ts, code/core/src/manager/components/review/review-navigation.ts, code/core/src/manager/components/review/review-navigation.test.ts, code/core/src/manager/components/review/review-notification.test.ts, code/core/src/manager/components/review/components/ReviewNotification.tsx
isReviewManagerRoute accepts string | undefined, review-return parsing uses query parameters, and related tests and notification behavior cover the updated route classification.
Review mode filter state
code/core/src/manager/components/review/review-mode.ts, code/core/src/manager/components/review/review-mode.test.ts, code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx
Review mode snapshots and restores only tag/status filters, and related tests and story assertions drop chrome-toggle expectations.
Leave review orchestration
code/core/src/manager/components/review/constants.ts, code/core/src/manager/components/review/review-actions.ts, code/core/src/manager/components/review/review-actions.test.ts, code/core/src/manager/components/review/components/ReviewProvider.tsx, code/core/src/manager/components/review/useReviewNavigationInterceptor.ts, code/core/src/manager/components/review/ReviewPage.stories.tsx
navigateOutOfReview becomes async, records visits conditionally, uses an exiting-session guard, and the provider passes the dismissal options and skips re-entering review while exiting.
Route-based chrome visibility
code/core/src/manager-api/modules/shortcuts.ts, code/core/src/manager/components/layout/Layout.tsx, code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx, code/core/src/manager/components/review/screens/ReviewSummaryPortal.tsx, code/core/src/manager/components/layout/Layout.stories.tsx
Shortcut handling, layout, mobile navigation, review summary insets, and the mobile review story now suppress sidebar and menu chrome on review routes.
Preview toolbar and menu gating
code/core/src/manager/components/preview/Preview.tsx, code/core/src/manager/components/preview/Toolbar.tsx, code/core/src/manager/components/preview/tools/menu.tsx
Preview toolbar header and preview menu rendering now depend on review collection query state and review-route matching.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • storybookjs/storybook#34790: The mobile navigation changes here also gate the bottom bar and menu UI based on route and panel state, which is closely related to the mobile rendering changes in that PR.
  • storybookjs/storybook#35222: Both PRs modify isReviewReturnSearch and the review return-path classification used by review navigation.
  • storybookjs/storybook#35276: Both PRs touch review-notification behavior and the route-based conditions used to auto-handle review visits.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

♻️ Duplicate comments (1)
code/core/src/manager/components/review/review-mode.ts (1)

54-58: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Active-flag write still precedes the awaited filter setters.

Line 55 marks review mode active before setAllTagFilters/setAllStatusFilters resolve. If either rejects, the early-return guard at Line 50 makes every later enterReviewMode() a no-op while the transition never completed, leaving filters in a partial state. Defer the flag write until both setters succeed and roll back the snapshot on failure.

Suggested fix
-  sessionStore.write(FILTERS_SNAPSHOT_SESSION_KEY, JSON.stringify(filters));
-  sessionStore.write(REVIEW_MODE_SESSION_KEY, '1');
-
-  await api.setAllTagFilters([], []);
-  await api.setAllStatusFilters([REVIEWING_STATUS_VALUE], []);
+  sessionStore.write(FILTERS_SNAPSHOT_SESSION_KEY, JSON.stringify(filters));
+  try {
+    await api.setAllTagFilters([], []);
+    await api.setAllStatusFilters([REVIEWING_STATUS_VALUE], []);
+    sessionStore.write(REVIEW_MODE_SESSION_KEY, '1');
+  } catch (error) {
+    sessionStore.remove(FILTERS_SNAPSHOT_SESSION_KEY);
+    throw error;
+  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/core/src/manager/components/review/review-mode.ts` around lines 54 - 58,
The review mode activation flag is being written before the awaited filter
updates complete, so a rejection can leave the session marked active while the
transition never finished. In enterReviewMode(), keep the snapshot write first,
then await api.setAllTagFilters and api.setAllStatusFilters, and only after both
succeed write REVIEW_MODE_SESSION_KEY. If either setter fails, do not set the
active flag and restore or clear the saved snapshot state so future
enterReviewMode() calls can retry cleanly.
🧹 Nitpick comments (1)
code/core/src/manager/components/preview/tools/menu.tsx (1)

14-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Misleading flag name: isReviewCollectionStory actually reflects the review-manager route.

This field is computed from isReviewManagerRoute(...), so it is true for any review-manager route, not specifically a "collection story". The same name isReviewCollectionStory is used in Preview.tsx but derived from REVIEW_COLLECTION_QUERY_PARAM, so reusing it here with different semantics is confusing. Consider renaming to something like isReviewManagerRoute/isReviewRoute for clarity.

♻️ Proposed rename
-  isReviewCollectionStory: isReviewManagerRoute(state.path, state.customQueryParams),
+  isReviewRoute: isReviewManagerRoute(state.path, state.customQueryParams),
-        {({ isVisible, showSidebar, singleStory, isReviewCollectionStory }) =>
+        {({ isVisible, showSidebar, singleStory, isReviewRoute }) =>
           !singleStory &&
           !isVisible &&
-          !isReviewCollectionStory && (
+          !isReviewRoute && (
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/core/src/manager/components/preview/tools/menu.tsx` around lines 14 -
17, The flag name in the preview menu is misleading because it is derived from
isReviewManagerRoute(...) rather than a collection-story-specific condition.
Rename the local boolean in menu.tsx to match its actual meaning, such as
isReviewManagerRoute or isReviewRoute, and update any references in the menu
component so the naming is consistent with the route check and does not conflict
with the different isReviewCollectionStory usage in Preview.tsx.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@code/core/src/manager/components/layout/Layout.tsx`:
- Around line 154-155: `Layout` is overriding the user’s existing nav visibility
when computing `showSidebar`, causing the sidebar to reappear on non-review
routes. Update the `showSidebar` derivation in `Layout.tsx` to preserve the
current nav-visibility state and only combine it with the route-based review
condition instead of replacing it. Make sure the same `showSidebar` value
continues to drive the desktop sidebar, mobile menu/drawer, and grid layout
consistently.

In `@code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx`:
- Around line 154-164: Reset the mobile menu state when showMenu turns false in
MobileNavigation so the drawer does not remount open after a route change.
Update the component logic around MobileNavigation and MobileMenuDrawer to close
isMobileMenuOpen whenever showMenu becomes false, either by syncing it in the
same conditional path or via an effect tied to showMenu. Make sure the state is
cleared before the drawer is hidden so reopening a route with showMenu true
starts closed.

In `@code/core/src/manager/components/review/ReviewPage.stories.tsx`:
- Around line 500-514: The ReviewPage story currently leaves
NOTIFIED_REVIEW_CREATED_AT_KEY and VISITED_REVIEW_CREATED_AT_KEY behind in
sessionStorage, making later stories order-dependent. Update the story setup
around the ReviewPage.stories.tsx play flow by using a story beforeEach or
decorator to seed and clean up these sessionStorage keys, or ensure they are
removed in a finally block after the play run. Keep the mock/context setup for
this story inside the story decorator or beforeEach, and reference the play
function and any helper that writes to sessionStorage so the cleanup stays close
to the seeded state.

---

Duplicate comments:
In `@code/core/src/manager/components/review/review-mode.ts`:
- Around line 54-58: The review mode activation flag is being written before the
awaited filter updates complete, so a rejection can leave the session marked
active while the transition never finished. In enterReviewMode(), keep the
snapshot write first, then await api.setAllTagFilters and
api.setAllStatusFilters, and only after both succeed write
REVIEW_MODE_SESSION_KEY. If either setter fails, do not set the active flag and
restore or clear the saved snapshot state so future enterReviewMode() calls can
retry cleanly.

---

Nitpick comments:
In `@code/core/src/manager/components/preview/tools/menu.tsx`:
- Around line 14-17: The flag name in the preview menu is misleading because it
is derived from isReviewManagerRoute(...) rather than a
collection-story-specific condition. Rename the local boolean in menu.tsx to
match its actual meaning, such as isReviewManagerRoute or isReviewRoute, and
update any references in the menu component so the naming is consistent with the
route check and does not conflict with the different isReviewCollectionStory
usage in Preview.tsx.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 590a6d25-914c-40e9-8ea2-fe8e7a304b97

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd8598 and ec096ee.

📒 Files selected for processing (16)
  • code/core/src/manager-api/modules/shortcuts.ts
  • code/core/src/manager/components/layout/Layout.stories.tsx
  • code/core/src/manager/components/layout/Layout.tsx
  • code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
  • code/core/src/manager/components/preview/Preview.tsx
  • code/core/src/manager/components/preview/tools/menu.tsx
  • code/core/src/manager/components/review/ReviewPage.stories.tsx
  • code/core/src/manager/components/review/components/ReviewNotification.tsx
  • code/core/src/manager/components/review/review-actions.ts
  • code/core/src/manager/components/review/review-mode.test.ts
  • code/core/src/manager/components/review/review-mode.ts
  • code/core/src/manager/components/review/review-notification.test.ts
  • code/core/src/manager/components/review/screens/ReviewSummaryPortal.tsx
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx
  • code/core/src/shared/review/routes.test.ts
  • code/core/src/shared/review/routes.ts
💤 Files with no reviewable changes (1)
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx

Comment thread code/core/src/manager/components/layout/Layout.tsx Outdated
Comment thread code/core/src/manager/components/review/ReviewPage.stories.tsx
@storybook-bot

Copy link
Copy Markdown
Contributor

Failed to publish canary version of this pull request, triggered by @ghengeveld. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/28442106040

Write REVIEW_MODE_SESSION_KEY only after setAllTagFilters and
setAllStatusFilters resolve, and remove the filters snapshot if either
setter rejects so a failed entry does not block re-entry.
Combine getIsNavShown with the review-route check so leaving review
does not remount the sidebar when the user had previously hidden nav.
Close isMobileMenuOpen via useLayoutEffect when the menu is hidden on
review routes so the drawer does not remount open after navigation.
Seed and remove NOTIFIED/VISITED review keys in beforeEach and a play
finally block so DismissesNotificationOnReviewVisit does not leak state
into later stories.
Await filter restoration before navigating away, mark visited reviews on exit,
block summary auto-enter during exit, and reject curated story URLs as return targets.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
code/core/src/manager/components/review/review-actions.test.ts (1)

59-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move these Vitest mock implementations into beforeEach.

This suite installs setAllTagFilters, setAllStatusFilters, and navigate behaviors directly inside the test body, which makes the setup harder to reuse and audit. Please move that behavior into beforeEach or a nested describe hook and keep the case focused on assertions. As per coding guidelines, "Implement mock behaviors in beforeEach blocks in Vitest tests" and "Avoid inline mock implementations within test cases in Vitest tests".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/core/src/manager/components/review/review-actions.test.ts` around lines
59 - 80, The Vitest mocks for setAllTagFilters, setAllStatusFilters, and
navigate are being redefined inline in the test body, which should be moved into
shared setup. Update the review-actions.test.ts suite by placing these
mockImplementation behaviors in a beforeEach (or a nested describe hook) near
enterReviewMode and the existing order setup, then keep the test case focused on
the assertions and any case-specific expectations only.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@code/core/src/manager/components/review/review-actions.ts`:
- Around line 60-81: Move the visit-marking logic in review-actions’ exit flow
so `acceptReviewNotification()` only runs after `exitReviewMode(api)` succeeds,
or otherwise wrap the exit path in error handling that rolls back any
suppression/state changes on failure. Update the `recordVisit` block and the
`exitReviewMode` try/finally flow in `review-actions.ts` so `reviewStore`,
`sessionStore`, and the toast suppression/visit persistence only commit after a
successful review exit, preventing unhandled rejections and premature visited
state.

---

Nitpick comments:
In `@code/core/src/manager/components/review/review-actions.test.ts`:
- Around line 59-80: The Vitest mocks for setAllTagFilters, setAllStatusFilters,
and navigate are being redefined inline in the test body, which should be moved
into shared setup. Update the review-actions.test.ts suite by placing these
mockImplementation behaviors in a beforeEach (or a nested describe hook) near
enterReviewMode and the existing order setup, then keep the test case focused on
the assertions and any case-specific expectations only.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f16bf65a-783d-4432-a478-0cb8c7ab021b

📥 Commits

Reviewing files that changed from the base of the PR and between ec096ee and b4b68df.

📒 Files selected for processing (13)
  • code/core/src/manager-api/modules/shortcuts.ts
  • code/core/src/manager/components/layout/Layout.tsx
  • code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
  • code/core/src/manager/components/review/ReviewPage.stories.tsx
  • code/core/src/manager/components/review/components/ReviewNotification.tsx
  • code/core/src/manager/components/review/components/ReviewProvider.tsx
  • code/core/src/manager/components/review/constants.ts
  • code/core/src/manager/components/review/review-actions.test.ts
  • code/core/src/manager/components/review/review-actions.ts
  • code/core/src/manager/components/review/review-mode.ts
  • code/core/src/manager/components/review/review-navigation.test.ts
  • code/core/src/manager/components/review/review-navigation.ts
  • code/core/src/manager/components/review/useReviewNavigationInterceptor.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • code/core/src/manager-api/modules/shortcuts.ts
  • code/core/src/manager/components/review/ReviewPage.stories.tsx
  • code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
  • code/core/src/manager/components/review/components/ReviewNotification.tsx
  • code/core/src/manager/components/review/review-mode.ts
  • code/core/src/manager/components/layout/Layout.tsx

Comment thread code/core/src/manager/components/review/review-actions.ts Outdated
Strip reviewing from restored filter snapshots, remove it when no snapshot
exists, and hide the fullscreen toolbar button on review routes.
Record review visits only after exitReviewMode succeeds, and mock the review
manager route in Layout MobileReview so the mobile menu assertion matches layout.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
code/core/src/manager/components/review/review-actions.test.ts (1)

134-156: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inline mockRejectedValueOnce conflicts with spy-mocking guideline.

As per coding guidelines for **/*.test.{ts,tsx,js,jsx}, mock behaviors should be "Implement[ed] ... in beforeEach blocks" and reviewers should "Avoid inline mock implementations within test cases." Line 140 sets setAllTagFilters.mockRejectedValueOnce(...) directly inside the test body rather than in beforeEach.

The test logic itself is sound: it correctly verifies that a restore failure during exitReviewMode short-circuits visit recording and notification clearing, matching navigateOutOfReview's try/finally flow.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/core/src/manager/components/review/review-actions.test.ts` around lines
134 - 156, The test in review-actions.test.ts is using an inline
mockRejectedValueOnce inside the case, which conflicts with the test mocking
guideline. Move the failure setup for setAllTagFilters into the test’s
beforeEach/shared setup used by navigateOutOfReview and enterReviewMode, or
apply the mock there and parameterize the case so the test body only exercises
the behavior. Keep the assertions around VISITED_REVIEW_CREATED_AT_KEY and
api.clearNotification unchanged, and reference the setAllTagFilters mock and
navigateOutOfReview flow when relocating the mock behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@code/core/src/manager/components/review/review-actions.test.ts`:
- Around line 134-156: The test in review-actions.test.ts is using an inline
mockRejectedValueOnce inside the case, which conflicts with the test mocking
guideline. Move the failure setup for setAllTagFilters into the test’s
beforeEach/shared setup used by navigateOutOfReview and enterReviewMode, or
apply the mock there and parameterize the case so the test body only exercises
the behavior. Keep the assertions around VISITED_REVIEW_CREATED_AT_KEY and
api.clearNotification unchanged, and reference the setAllTagFilters mock and
navigateOutOfReview flow when relocating the mock behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9bceef80-7463-413b-b25d-b36861091e28

📥 Commits

Reviewing files that changed from the base of the PR and between 0104a63 and cb63c84.

📒 Files selected for processing (3)
  • code/core/src/manager/components/layout/Layout.stories.tsx
  • code/core/src/manager/components/review/review-actions.test.ts
  • code/core/src/manager/components/review/review-actions.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/core/src/manager/components/review/review-actions.ts

Only override ManagerContext in the story decorator; the meta decorator
already supplies router and layout providers.
@ghengeveld ghengeveld closed this Jul 1, 2026
@Sidnioulz Sidnioulz removed the qa:needed Pull Requests that will need manual QA prior to release. label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
Fails
🚫

PR is not labeled with one of: ["qa:needed","qa:skip","qa:success"]

Generated by 🚫 dangerJS against 34d3be7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). maintenance User-facing maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants