Skip to content

Review: Simplify layout handling - #35322

Merged
ghengeveld merged 16 commits into
nextfrom
ghengeveld/review-fullscreen-summary
Jul 1, 2026
Merged

ghengeveld merged 16 commits into
nextfrom
ghengeveld/review-fullscreen-summary

Conversation

@ghengeveld

@ghengeveld ghengeveld commented Jun 29, 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.

@ghengeveld ghengeveld self-assigned this Jun 29, 2026
@ghengeveld
ghengeveld requested a review from yannbf June 29, 2026 13:53
@coderabbitai

coderabbitai Bot commented Jun 29, 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
📝 Walkthrough

Walkthrough

Refactors review-mode session handling into smaller helpers, updates review entry points to capture and restore return navigation state, changes review navigation to validate return targets, simplifies the review summary portal positioning, and hides the sidebar when the manager is in review view mode.

Changes

Review Cycle Refactor and Layout Integration

Layer / File(s) Summary
review-mode.ts: composable session helpers
code/core/src/manager/components/review/review-mode.ts
Adds session-storage keys and exports markReviewModeActive, initializeSessionChromeIfNeeded, initializeSessionFiltersIfNeeded, applyReviewingFilters, and applyReviewingFiltersForReviewIfNeeded; removes enterReviewMode; exitReviewMode now clears only the active flag and last-applied createdAt marker.
review-mode.test.ts: updated helper coverage
code/core/src/manager/components/review/review-mode.test.ts
Replaces enterReviewMode-focused tests with coverage for each new helper, idempotency, deduplication by createdAt, and updated exitReviewMode setup.
review-entry.ts: capturePreReviewReturn and beginReviewCycle
code/core/src/manager/components/review/review-entry.ts, code/core/src/manager/components/review/constants.ts, code/core/src/manager/components/review/review-entry.test.ts
Adds capturePreReviewReturn to persist a pre-review return search for story/docs routes only, and beginReviewCycle to idempotently activate review mode, with new Vitest test coverage and the PRE_REVIEW_RETURN_KEY comment update.
review-navigation.ts: return search parsing
code/core/src/manager/components/review/review-navigation.ts, code/core/src/manager/components/review/review-navigation.test.ts
Adds parseCanvasStoryIdFromReturnSearch that extracts a story id from return search strings for story/docs view modes only, returning null for review paths, with matching tests.
review-actions.ts: simplified navigation signatures
code/core/src/manager/components/review/review-actions.ts
Removes filters parameter from navigateToReviewEntry and navigateToReviewSummary; adds isReturnSearchNavigable guard to navigateOutOfReview using parseCanvasStoryIdFromReturnSearch and api.resolveStory.
Review entry points: wire new cycle helpers
code/core/src/manager/components/sidebar/ReviewWidget.tsx, code/core/src/manager/components/sidebar/ReviewWidget.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/useReviewNavigationInterceptor.ts, code/core/src/manager/components/review/useReviewShortcuts.ts, code/core/src/manager/components/review/useReviewFiltersRef.ts
All review entry points now call capturePreReviewReturn and beginReviewCycle before navigating and no longer pass filter refs into navigation helpers; ReviewProvider’s auto-enter flow uses the new session helpers; story expectations update to assert filter/chrome mocks are not called.
Summary portal simplification and sidebar hiding
code/core/src/manager/components/review/screens/ReviewSummaryPortal.tsx, code/core/src/manager/components/layout/Layout.tsx
ReviewSummaryPortal removes inset-based positioning for edge-to-edge placement; Layout derives showSidebar from viewMode !== 'review', conditionally renders the sidebar on desktop, and updates the CSS grid template columns and areas for sidebar-absent layouts.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • storybookjs/storybook#35220: Both PRs coordinate the review flow’s handling of path-based return-search parsing/navigation.
  • storybookjs/storybook#35222: Directly overlaps with the review-filter ref and review navigation call chain that this PR removes from navigateToReview*.
  • storybookjs/storybook#35232: Touches review-mode.ts and surrounding review lifecycle/navigation wiring in the same manager path being refactored here.

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

🤖 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 240-266: The no-sidebar branch in Layout.tsx defines a 2-column
grid via gridTemplateColumns, but the gridTemplateAreas cases for showSidebar
=== false still emit 3 area tokens per row, making the template invalid. Update
the no-sidebar return strings in the layout logic to match the 2-column desktop
grid, especially the branches that depend on showPanel and panelPosition. Keep
the area names aligned with the actual columns so the review layout renders
correctly.

In `@code/core/src/manager/components/review/review-entry.ts`:
- Around line 12-24: capturePreReviewReturn currently overwrites
PRE_REVIEW_RETURN_KEY on every story/docs navigation, so update the
capturePreReviewReturn function to write only once per review cycle by checking
whether review mode is already active or whether sessionStore already has a
stored pre-review return value before calling sessionStore.write. Keep the
existing story/docs path parsing and normalizeSearch flow, but add the guard
around the write using the capturePreReviewReturn and PRE_REVIEW_RETURN_KEY
symbols. Add a regression test that calls capturePreReviewReturn multiple times
within one cycle and verifies the first snapshot is preserved.

In `@code/core/src/manager/components/review/review-mode.ts`:
- Around line 66-92: The session snapshot keys are never cleared after being
restored, so later calls can replay stale chrome/filter state. Update the
review-mode flow in exitReviewMode and the related restore logic to consume
CHROME_SNAPSHOT_SESSION_KEY and FILTERS_SNAPSHOT_SESSION_KEY after applying
them, and make initializeSessionFiltersIfNeeded / the chrome snapshot write path
only persist fresh state once per cycle so subsequent exits do not overwrite
newer user changes.
🪄 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: 9b45caa5-cf18-4419-b706-c43756034006

📥 Commits

Reviewing files that changed from the base of the PR and between 5e02302 and f5e7708.

📒 Files selected for processing (17)
  • code/core/src/manager/components/layout/Layout.tsx
  • code/core/src/manager/components/review/ReviewPersistentLayer.tsx
  • code/core/src/manager/components/review/ReviewProvider.tsx
  • code/core/src/manager/components/review/ReviewSummaryPortal.tsx
  • code/core/src/manager/components/review/constants.ts
  • code/core/src/manager/components/review/review-actions.ts
  • code/core/src/manager/components/review/review-entry.test.ts
  • code/core/src/manager/components/review/review-entry.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-navigation.test.ts
  • code/core/src/manager/components/review/review-navigation.ts
  • code/core/src/manager/components/review/useReviewFiltersRef.ts
  • code/core/src/manager/components/review/useReviewNavigationInterceptor.ts
  • code/core/src/manager/components/review/useReviewShortcuts.ts
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx
  • code/core/src/manager/components/sidebar/ReviewWidget.tsx
💤 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
Comment thread code/core/src/manager/components/review/review-entry.ts Outdated
Comment thread code/core/src/manager/components/review/review-mode.ts Outdated
@ghengeveld ghengeveld changed the title Review summary: full-screen layout with session-aware chrome Review: Simplify layout handling Jun 29, 2026
@ghengeveld
ghengeveld force-pushed the ghengeveld/review-fullscreen-summary branch from 63525ee to c4e6851 Compare June 29, 2026 14:16
@ghengeveld
ghengeveld changed the base branch from next to review/review-arrival June 29, 2026 14:16

@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

🤖 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/sidebar/ReviewWidget.stories.tsx`:
- Around line 111-113: Keep ReviewWidget.stories in sync with review navigation
by updating the Storybook state path alongside the MemoryRouter route. The issue
is that ReviewProvider reads useStorybookState().path, but this story leaves
path at '/' so the summary-side effects for the /review/ flow never run. Adjust
the story setup in ReviewWidget.stories and the relevant review-navigation
render path so the state path reflects '/review/' when testing OpenReview and
the chrome/filter initialization behavior.

In `@code/core/src/manager/components/sidebar/ReviewWidget.tsx`:
- Around line 89-92: The return-state capture in ReviewWidget’s onOpen is using
window.location.search, which can get out of sync with the router state. Update
the call to capturePreReviewReturn to use the current router search value from
location first, falling back to window.location.search only when needed, so
dismiss navigation restores the correct place under MemoryRouter. Use the
existing onOpen handler and location reference in ReviewWidget to make the
change.
🪄 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: 889603d3-cf66-47a8-9420-ccec1868b4a5

📥 Commits

Reviewing files that changed from the base of the PR and between 63525ee and c4e6851.

📒 Files selected for processing (17)
  • code/core/src/manager/components/layout/Layout.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.ts
  • code/core/src/manager/components/review/review-entry.test.ts
  • code/core/src/manager/components/review/review-entry.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-navigation.test.ts
  • code/core/src/manager/components/review/review-navigation.ts
  • code/core/src/manager/components/review/screens/ReviewSummaryPortal.tsx
  • code/core/src/manager/components/review/useReviewFiltersRef.ts
  • code/core/src/manager/components/review/useReviewNavigationInterceptor.ts
  • code/core/src/manager/components/review/useReviewShortcuts.ts
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx
  • code/core/src/manager/components/sidebar/ReviewWidget.tsx
✅ Files skipped from review due to trivial changes (2)
  • code/core/src/manager/components/review/useReviewFiltersRef.ts
  • code/core/src/manager/components/review/constants.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • code/core/src/manager/components/review/review-navigation.ts
  • code/core/src/manager/components/review/review-entry.ts
  • code/core/src/manager/components/review/review-entry.test.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/useReviewNavigationInterceptor.ts
  • code/core/src/manager/components/review/review-mode.test.ts
  • code/core/src/manager/components/review/useReviewShortcuts.ts
  • code/core/src/manager/components/review/review-actions.ts
  • code/core/src/manager/components/layout/Layout.tsx

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

🤖 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/sidebar/ReviewWidget.stories.tsx`:
- Around line 111-113: Keep ReviewWidget.stories in sync with review navigation
by updating the Storybook state path alongside the MemoryRouter route. The issue
is that ReviewProvider reads useStorybookState().path, but this story leaves
path at '/' so the summary-side effects for the /review/ flow never run. Adjust
the story setup in ReviewWidget.stories and the relevant review-navigation
render path so the state path reflects '/review/' when testing OpenReview and
the chrome/filter initialization behavior.

In `@code/core/src/manager/components/sidebar/ReviewWidget.tsx`:
- Around line 89-92: The return-state capture in ReviewWidget’s onOpen is using
window.location.search, which can get out of sync with the router state. Update
the call to capturePreReviewReturn to use the current router search value from
location first, falling back to window.location.search only when needed, so
dismiss navigation restores the correct place under MemoryRouter. Use the
existing onOpen handler and location reference in ReviewWidget to make the
change.
🪄 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: 889603d3-cf66-47a8-9420-ccec1868b4a5

📥 Commits

Reviewing files that changed from the base of the PR and between 63525ee and c4e6851.

📒 Files selected for processing (17)
  • code/core/src/manager/components/layout/Layout.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.ts
  • code/core/src/manager/components/review/review-entry.test.ts
  • code/core/src/manager/components/review/review-entry.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-navigation.test.ts
  • code/core/src/manager/components/review/review-navigation.ts
  • code/core/src/manager/components/review/screens/ReviewSummaryPortal.tsx
  • code/core/src/manager/components/review/useReviewFiltersRef.ts
  • code/core/src/manager/components/review/useReviewNavigationInterceptor.ts
  • code/core/src/manager/components/review/useReviewShortcuts.ts
  • code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx
  • code/core/src/manager/components/sidebar/ReviewWidget.tsx
✅ Files skipped from review due to trivial changes (2)
  • code/core/src/manager/components/review/useReviewFiltersRef.ts
  • code/core/src/manager/components/review/constants.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • code/core/src/manager/components/review/review-navigation.ts
  • code/core/src/manager/components/review/review-entry.ts
  • code/core/src/manager/components/review/review-entry.test.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/useReviewNavigationInterceptor.ts
  • code/core/src/manager/components/review/review-mode.test.ts
  • code/core/src/manager/components/review/useReviewShortcuts.ts
  • code/core/src/manager/components/review/review-actions.ts
  • code/core/src/manager/components/layout/Layout.tsx
🛑 Comments failed to post (2)
code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx (1)

111-113: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the story and provider files, then inspect the relevant ranges.
git ls-files 'code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx' \
             'code/core/src/manager/components/sidebar/*Review*' \
             'code/core/src/manager/components/sidebar/*Provider*' \
             'code/core/src/manager/**/*Review*' \
             'code/core/src/manager/**/*Provider*'

echo "---- story outline ----"
ast-grep outline code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx --view expanded || true

echo "---- story excerpt ----"
sed -n '1,220p' code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx

echo "---- related provider/search ----"
rg -n "initializeSessionChromeIfNeeded|initializeSessionFiltersIfNeeded|applyReviewingFiltersForReviewIfNeeded|useStorybookState\\(|path:" code/core/src/manager -g '*.ts' -g '*.tsx' || true

Repository: storybookjs/storybook

Length of output: 18134


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- ReviewProvider.tsx ----"
sed -n '1,180p' code/core/src/manager/components/review/components/ReviewProvider.tsx

echo "---- ReviewWidget.stories.tsx around OpenReview ----"
sed -n '220,290p' code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx

echo "---- ReviewPage.stories.tsx url-state harness for comparison ----"
sed -n '1,120p' code/core/src/manager/components/review/ReviewPage.stories.tsx

Repository: storybookjs/storybook

Length of output: 13249


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- ReviewProvider.tsx around path/summary logic ----"
sed -n '180,320p' code/core/src/manager/components/review/components/ReviewProvider.tsx

echo "---- review-navigation helpers ----"
sed -n '1,180p' code/core/src/manager/components/review/review-navigation.ts

echo "---- ReviewWidget.tsx interaction points ----"
sed -n '1,220p' code/core/src/manager/components/sidebar/ReviewWidget.tsx

Repository: storybookjs/storybook

Length of output: 12485


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,220p' code/core/src/manager/components/review/review-actions.ts

Repository: storybookjs/storybook

Length of output: 2412


Sync state.path with the review navigation (lines 111-113, 265-268)

ReviewProvider keys its summary-side effects off useStorybookState().path, but this story keeps that value at '/' while only the MemoryRouter location changes. The OpenReview assertions can pass without covering the /review/ path that triggers the chrome/filter initialization.

🤖 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/sidebar/ReviewWidget.stories.tsx` around
lines 111 - 113, Keep ReviewWidget.stories in sync with review navigation by
updating the Storybook state path alongside the MemoryRouter route. The issue is
that ReviewProvider reads useStorybookState().path, but this story leaves path
at '/' so the summary-side effects for the /review/ flow never run. Adjust the
story setup in ReviewWidget.stories and the relevant review-navigation render
path so the state path reflects '/review/' when testing OpenReview and the
chrome/filter initialization behavior.
code/core/src/manager/components/sidebar/ReviewWidget.tsx (1)

89-92: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

files=(
  "code/core/src/manager/components/sidebar/ReviewWidget.tsx"
  "code/core/src/manager/components/review/components/ReviewNotification.tsx"
  "code/core/src/manager/components/review/components/ReviewProvider.tsx"
  "code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx"
)

for f in "${files[@]}"; do
  echo "===== $f ====="
  wc -l "$f"
  echo "--- outline ---"
  ast-grep outline "$f" --view expanded || true
  echo
done

Repository: storybookjs/storybook

Length of output: 3261


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,220p' code/core/src/manager/components/sidebar/ReviewWidget.tsx
echo '====='
sed -n '1,240p' code/core/src/manager/components/review/components/ReviewNotification.tsx
echo '====='
sed -n '1,260p' code/core/src/manager/components/review/components/ReviewProvider.tsx
echo '====='
sed -n '1,260p' code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx

Repository: storybookjs/storybook

Length of output: 23421


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== ReviewWidget.tsx ==="
nl -ba code/core/src/manager/components/sidebar/ReviewWidget.tsx | sed -n '1,170p'
echo
echo "=== ReviewNotification.tsx ==="
nl -ba code/core/src/manager/components/review/components/ReviewNotification.tsx | sed -n '1,220p'
echo
echo "=== ReviewProvider.tsx ==="
nl -ba code/core/src/manager/components/review/components/ReviewProvider.tsx | sed -n '1,240p'
echo
echo "=== ReviewWidget.stories.tsx ==="
nl -ba code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx | sed -n '1,240p'

Repository: storybookjs/storybook

Length of output: 224


Use the current router search here — window.location.search can diverge from Storybook’s router state under MemoryRouter; capture location?.search ?? window.location.search so dismiss returns to the right place.

🤖 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/sidebar/ReviewWidget.tsx` around lines 89 -
92, The return-state capture in ReviewWidget’s onOpen is using
window.location.search, which can get out of sync with the router state. Update
the call to capturePreReviewReturn to use the current router search value from
location first, falling back to window.location.search only when needed, so
dismiss navigation restores the correct place under MemoryRouter. Use the
existing onOpen handler and location reference in ReviewWidget to make the
change.

Base automatically changed from review/review-arrival to next June 29, 2026 14:30
@ghengeveld ghengeveld added maintenance User-facing maintenance tasks 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. labels Jun 29, 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: 1

Caution

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

⚠️ Outside diff range comments (1)
code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx (1)

307-316: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Fold the route assertion into the existing waitFor. The /review/ check is still a one-shot assertion and can run before the router-driven router-path update lands. Move it into the same waitFor as the other post-click assertions.

🤖 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/sidebar/ReviewWidget.stories.tsx` around
lines 307 - 316, The route assertion for the `router-path` in
`ReviewWidget.stories.tsx` is still happening outside the async stabilization
block, so it can fire before the router update is reflected. Move the
`canvas.getByTestId('router-path')` expectation into the existing `waitFor`
alongside the `toggleNavMock`, `togglePanelMock`, `setAllTagFiltersMock`, and
`setAllStatusFiltersMock` assertions so the post-click checks all wait for the
same state transition.

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/sidebar/ReviewWidget.stories.tsx`:
- Around line 172-189: `ReviewWidget.stories.tsx` is still hardcoding the
MemoryRouter start location to `/`, so the seeded `contextOptions.path` and
review collection query never take effect on first render. Update the story’s
router setup to initialize `MemoryRouter` from `contextOptions` (including any
seeded `REVIEW_COLLECTION_QUERY_PARAM`) and keep
`ManagerStateSync`/`makeManagerContext` aligned with that initial location so
preselected review routes work correctly.

---

Outside diff comments:
In `@code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx`:
- Around line 307-316: The route assertion for the `router-path` in
`ReviewWidget.stories.tsx` is still happening outside the async stabilization
block, so it can fire before the router update is reflected. Move the
`canvas.getByTestId('router-path')` expectation into the existing `waitFor`
alongside the `toggleNavMock`, `togglePanelMock`, `setAllTagFiltersMock`, and
`setAllStatusFiltersMock` assertions so the post-click checks all wait for the
same state transition.
🪄 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: eaa51635-1409-4a2c-9fd2-f92458f2157c

📥 Commits

Reviewing files that changed from the base of the PR and between 03c94b7 and 30ee4a6.

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

Comment thread code/core/src/manager/components/sidebar/ReviewWidget.stories.tsx Outdated
@storybook-app-bot

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

Copy link
Copy Markdown
Contributor

Package Benchmarks

Commit: 34d3be7, ran on 1 July 2026 at 15:18:36 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 72 72 0
Self size 21.92 MB 21.90 MB 🎉 -20 KB 🎉
Dependency size 36.44 MB 36.44 MB 0 B
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 204 204 0
Self size 821 KB 821 KB 0 B
Dependency size 91.76 MB 91.74 MB 🎉 -20 KB 🎉
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 197 197 0
Self size 32 KB 32 KB 0 B
Dependency size 90.24 MB 90.22 MB 🎉 -20 KB 🎉
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 73 73 0
Self size 1.09 MB 1.09 MB 0 B
Dependency size 58.36 MB 58.34 MB 🎉 -20 KB 🎉
Bundle Size Analyzer node node

@ghengeveld

Copy link
Copy Markdown
Member Author

Babysit update while AFK:

  • Fixed CI failure (typescript-validation): deriveViewMode in ReviewWidget.stories.tsx now handles parsePath().viewMode being string | undefined (95a143d).
  • Earlier fix (2891e6b): clear chrome/filter session snapshots on exitReviewMode so later exits cannot restore stale state.

All CodeRabbit threads are resolved. Local validation: core:check, review unit tests, and ReviewWidget/ReviewPage story tests pass.

Awaiting CI re-run and @yannbf review.

@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/28428414509

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

@yannbf yannbf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM as long as the flicker is resolved. The story has to be unmounted so there's no flicker in the navigation

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.
This was referenced Jul 13, 2026
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 qa:success Pull Requests that were successfully QA'ed by the release team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants