Skip to content

Controls: Improve ArgsTable empty state guidance#34857

Merged
Sidnioulz merged 5 commits into
storybookjs:nextfrom
Aniketiitk21:docs/args-table-empty-state-guidance
May 27, 2026
Merged

Controls: Improve ArgsTable empty state guidance#34857
Sidnioulz merged 5 commits into
storybookjs:nextfrom
Aniketiitk21:docs/args-table-empty-state-guidance

Conversation

@Aniketiitk21
Copy link
Copy Markdown
Contributor

@Aniketiitk21 Aniketiitk21 commented May 20, 2026

What I did

Improved the ArgsTable empty state in addon-docs to make the "no controls" case more actionable.

  • updated the empty state title and helper copy to explain how args, argTypes, and docgen affect controls
  • renamed the CTA to Learn how to configure controls
  • added story assertions for the empty state in both standalone and addon-panel contexts
  • added a unit test for the delayed empty-state render

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

  1. Run the local Storybook UI from the repo sandbox
  2. Open the Components/ArgsTable/ArgsTable stories
  3. Check Empty
  4. Check EmptyInsideAddonPanel
  5. Verify the title reads No controls available for this story
  6. Verify the helper copy mentions args, argTypes, and docgen
  7. Verify the CTA link reads Learn how to configure controls

Documentation

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

Summary by CodeRabbit

  • Documentation
    • Updated empty-state text to say “This story has no controls” and instruct adding args/argTypes or enabling docgen; footer simplified to a single external “Read docs” link to the controls documentation.
  • Tests
    • Empty-state stories now include interactive play checks that verify the empty-state messages appear and the visible “Read docs” link is present and points to the controls docs.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

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

EmptyTabContent copy now uses the title "This story has no controls" with guidance to define args/argTypes or enable docgen; the footer always shows a single "Read docs" external link. Story files import expect/within from storybook/test, add an expectEmptyState(canvasElement) helper, and attach play functions to Empty and EmptyInsideAddonPanel that run those assertions.

Changes

Empty State UI Update and Testing

Layer / File(s) Summary
Empty component copy and footer update
code/addons/docs/src/blocks/components/ArgsTable/Empty.tsx
EmptyTabContent title changed to "This story has no controls", description updated to instruct adding args/argTypes or configuring docgen, and the footer simplified to always render a single external "Read docs" link.
Story play helpers and assertions
code/addons/docs/src/blocks/components/ArgsTable/ArgsTable.stories.tsx
Adds import of expect/within from storybook/test, introduces expectEmptyState(canvasElement), updates Empty to a Story-typed export with a play that calls the helper, and adds a play to EmptyInsideAddonPanel that runs the same assertions.

🎯 3 (Moderate) | ⏱️ ~20 minutes


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

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
code/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx (1)

1-33: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Move these assertions into stories and remove this component unit test file.

Line 1 introduces a *.test.tsx for a React component, but this repo requires interaction/behavior assertions to live in *.stories.tsx play functions (which this PR already adds in ArgsTable.stories.tsx). Keeping both creates policy drift and redundant maintenance.

As per coding guidelines, “For React components, write Storybook stories with play functions — do NOT write *.test.tsx unit tests; behavior, accessibility, and interaction assertions belong in *.stories.tsx co-located with the component”.

🤖 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/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx` around lines
1 - 33, Remove the unit test file Empty.test.tsx and move its
interaction/assertion logic into the story play function(s) for the Empty
component in ArgsTable.stories.tsx; specifically, take the assertions that use
renderEmpty, screen.findByText, screen.queryByText, and screen.getByRole (the
checks for "No controls available for this story", the guidance text, and the
"Learn how to configure controls" link href) and implement them as play-time
assertions in the appropriate story's play() so behavior testing lives in the
story, then delete the Empty.test.tsx file to avoid duplicate tests.
🧹 Nitpick comments (1)
code/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx (1)

9-9: ⚡ Quick win

Use explicit extension for the relative import.

Line 9 should use an explicit module extension for consistency with repo TypeScript import rules.

Proposed fix
-import { Empty } from './Empty';
+import { Empty } from './Empty.tsx';

As per coding guidelines, “For TypeScript source in the repo, prefer explicit file extensions for relative code imports and exports such as ./foo.ts or ./bar.tsx when the target is another TS/JS module”.

🤖 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/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx` at line 9,
Update the relative import to include the explicit TypeScript extension: replace
the import of the Empty component ("import { Empty } from './Empty';") with the
explicit extension form ("import { Empty } from './Empty.tsx';") so it follows
the repo rule for TypeScript source imports and resolves the Empty symbol
correctly.
🤖 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.

Outside diff comments:
In `@code/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx`:
- Around line 1-33: Remove the unit test file Empty.test.tsx and move its
interaction/assertion logic into the story play function(s) for the Empty
component in ArgsTable.stories.tsx; specifically, take the assertions that use
renderEmpty, screen.findByText, screen.queryByText, and screen.getByRole (the
checks for "No controls available for this story", the guidance text, and the
"Learn how to configure controls" link href) and implement them as play-time
assertions in the appropriate story's play() so behavior testing lives in the
story, then delete the Empty.test.tsx file to avoid duplicate tests.

---

Nitpick comments:
In `@code/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx`:
- Line 9: Update the relative import to include the explicit TypeScript
extension: replace the import of the Empty component ("import { Empty } from
'./Empty';") with the explicit extension form ("import { Empty } from
'./Empty.tsx';") so it follows the repo rule for TypeScript source imports and
resolves the Empty symbol correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc2fdca1-daa1-4584-ab35-e991923cfed3

📥 Commits

Reviewing files that changed from the base of the PR and between 8d9719c and 4b325a8.

📒 Files selected for processing (3)
  • code/addons/docs/src/blocks/components/ArgsTable/ArgsTable.stories.tsx
  • code/addons/docs/src/blocks/components/ArgsTable/Empty.test.tsx
  • code/addons/docs/src/blocks/components/ArgsTable/Empty.tsx

@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented May 21, 2026

Package Benchmarks

Commit: 80a2ecc, ran on 26 May 2026 at 14:54:31 UTC

No significant changes detected, all good. 👏

Copy link
Copy Markdown
Contributor

@Sidnioulz Sidnioulz left a comment

Choose a reason for hiding this comment

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

I find myself in stark approval! Thank you for this PR!

I will run this by our design team for content review and will make sure it gets merged. I'll let you know if you have any followup actions.

@Sidnioulz Sidnioulz changed the title docs: improve ArgsTable empty state guidance Controls: Improve ArgsTable empty state guidance May 26, 2026
@Sidnioulz Sidnioulz force-pushed the docs/args-table-empty-state-guidance branch from 4e465fd to 3c250b2 Compare May 26, 2026 10:45
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/addons/docs/src/blocks/components/ArgsTable/ArgsTable.stories.tsx`:
- Line 163: Delete the pre-delay negative assertion in the story play: remove
the line that does await expect(canvas.queryByText('This story has no
controls')).not.toBeInTheDocument(); in ArgsTable.stories.tsx because Empty.tsx
intentionally returns null then sets isLoading after a timeout and that negative
check makes the test flaky; target the play block in the ArgsTable story (where
canvas.queryByText is used) and either omit the negative assertion entirely or
replace it with a deterministic wait/assert for the final state instead.
🪄 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: c7b307c5-7ebe-4a0d-8174-aeb9f1e6f0ae

📥 Commits

Reviewing files that changed from the base of the PR and between d97cc98 and a26bbe8.

📒 Files selected for processing (2)
  • code/addons/docs/src/blocks/components/ArgsTable/ArgsTable.stories.tsx
  • code/addons/docs/src/blocks/components/ArgsTable/Empty.tsx

Comment thread code/addons/docs/src/blocks/components/ArgsTable/ArgsTable.stories.tsx Outdated
@Sidnioulz Sidnioulz merged commit 0385ad4 into storybookjs:next May 27, 2026
133 checks passed
@github-project-automation github-project-automation Bot moved this from Empathy Queue (prioritized) to Done in Core Team Projects May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants