Skip to content

Docs: Improve fn details for Actions#34654

Merged
kylegach merged 2 commits into
nextfrom
docs-improve-actions-fn
Apr 29, 2026
Merged

Docs: Improve fn details for Actions#34654
kylegach merged 2 commits into
nextfrom
docs-improve-actions-fn

Conversation

@kylegach
Copy link
Copy Markdown
Contributor

@kylegach kylegach commented Apr 29, 2026

What I did

See title

Checklist for Contributors

Testing

Manual testing

N/A — docs-only change

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

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

Summary by CodeRabbit

  • Documentation
    • Clarified how mocks and spies are handled in the actions panel.
    • Added guidance on naming mocks so they appear correctly in action logs.
    • Explained when automatic action logging occurs for test-provided mocks/spies and how to ensure visibility.

Co-authored-by: Copilot <copilot@github.com>
@kylegach kylegach self-assigned this Apr 29, 2026
@kylegach kylegach requested a review from jonniebigodes as a code owner April 29, 2026 17:45
@kylegach kylegach added documentation ci:docs Run the CI jobs for documentation checks only. labels Apr 29, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

Documentation clarifies the actions guide: it specifies using storybook/test's fn() by assigning the result to story args so Storybook auto-spies, requires mockName(...) for fn() mocks created outside args to appear in the actions panel, and refines when automatic action logging applies to mocks and spyOn results.

Changes

Cohort / File(s) Summary
Documentation Updates
docs/essentials/actions.mdx
Updated actions docs to recommend assigning fn() results to args for automatic spying; added explicit requirement that fn() mocks created outside args must call mockName(...) to appear in the actions panel; clarified automatic action-logging behavior for storybook/test mocks and spyOn usage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes


Review rate limit: 3/5 reviews remaining, refill in 16 minutes and 4 seconds.

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/essentials/actions.mdx (1)

25-25: Tighten phrasing (“outside args”).

Line 25 can be simplified for readability.

✏️ Suggested wording
-If you are defining a mock function with `fn()` outside of `args`, you must provide a name for it to automatically log to the actions panel:
+If you are defining a mock function with `fn()` outside `args`, you must provide a name for it to automatically log to the actions panel:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/essentials/actions.mdx` at line 25, The sentence "If you are defining a
mock function with `fn()` outside of `args`, you must provide a name for it to
automatically log to the actions panel:" is wordy; change it to a tighter
phrasing such as "If you define a mock function with `fn()` outside `args`, give
it a name to have it automatically log to the Actions panel." Update the line to
use this concise wording, keeping the references to `fn()` and `args` and the
Actions panel capitalization.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/essentials/actions.mdx`:
- Line 17: The sentence currently implies an arg is passed into fn(); update the
wording to state that you assign fn() to an arg (i.e., set an arg equal to fn())
so it's clear the mock function is being assigned to the component arg;
reference fn(), arg and Storybook/interaction tests in the revised sentence to
make the direction explicit.

---

Nitpick comments:
In `@docs/essentials/actions.mdx`:
- Line 25: The sentence "If you are defining a mock function with `fn()` outside
of `args`, you must provide a name for it to automatically log to the actions
panel:" is wordy; change it to a tighter phrasing such as "If you define a mock
function with `fn()` outside `args`, give it a name to have it automatically log
to the Actions panel." Update the line to use this concise wording, keeping the
references to `fn()` and `args` and the Actions panel capitalization.
🪄 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: 93afb0be-e3d7-4c52-812f-44e518f38b70

📥 Commits

Reviewing files that changed from the base of the PR and between dc5b803 and e49e97f.

📒 Files selected for processing (1)
  • docs/essentials/actions.mdx

Comment thread docs/essentials/actions.mdx Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

🧹 Nitpick comments (1)
docs/essentials/actions.mdx (1)

25-29: Tighten the wording here.

“outside of args” reads a bit redundant; “outside args” is cleaner without changing the meaning.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/essentials/actions.mdx` around lines 25 - 29, Update the sentence to use
tighter wording by replacing "outside of `args`" with "outside `args`" in the
documentation text that explains naming mock functions (referencing fn(), args,
handleClick, and mockName); ensure the example remains unchanged and the
surrounding sentence reads: "If you are defining a mock function with `fn()`
outside `args`, you must provide a name for it to automatically log to the
actions panel."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/essentials/actions.mdx`:
- Around line 25-29: Update the sentence to use tighter wording by replacing
"outside of `args`" with "outside `args`" in the documentation text that
explains naming mock functions (referencing fn(), args, handleClick, and
mockName); ensure the example remains unchanged and the surrounding sentence
reads: "If you are defining a mock function with `fn()` outside `args`, you must
provide a name for it to automatically log to the actions panel."

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 50b83547-8d48-4b2a-a51a-7fde2a660a80

📥 Commits

Reviewing files that changed from the base of the PR and between e49e97f and 29920d9.

📒 Files selected for processing (1)
  • docs/essentials/actions.mdx

Copy link
Copy Markdown
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

LGTM!

@kylegach kylegach added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Apr 29, 2026
@kylegach kylegach merged commit aa4d8d8 into next Apr 29, 2026
19 checks passed
@kylegach kylegach deleted the docs-improve-actions-fn branch April 29, 2026 23:28
@JReinhold JReinhold removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-scan:mixed ci:docs Run the CI jobs for documentation checks only. documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants