Skip to content

fix(storybook): wrap story/decorator hooks in components (DeepSource JS-0820)#231

Merged
qnbs merged 1 commit into
mainfrom
fix/deepsource-storybook-hooks
Jun 24, 2026
Merged

fix(storybook): wrap story/decorator hooks in components (DeepSource JS-0820)#231
qnbs merged 1 commit into
mainfrom
fix/deepsource-storybook-hooks

Conversation

@qnbs

@qnbs qnbs commented Jun 24, 2026

Copy link
Copy Markdown
Owner

What

Resolves both JS-0820 (rules-of-hooks, Major) findings — both in Storybook files, where hooks ran in a story render callback / a decorator function. Valid at Storybook runtime, but the react-hooks rule flags them because the enclosing function isn't a capitalized component. Fixed honestly (the recommended Storybook pattern), not suppressed:

  • stories/Tabs.stories.tsx: useState → extracted WithPanelsDemo component; story renders <WithPanelsDemo />.
  • .storybook/preview.tsx: theme useEffect → extracted ThemeWrapper component (theme/appearance as props); decorator renders <ThemeWrapper>…<Story/></ThemeWrapper>.

Rendered output is unchanged — pure structural refactor so the hook lives in a component.

Verification

pnpm run lint ✅ · pnpm run typecheck ✅ · behavior-preserving (same DOM). Storybook test-runner unaffected (same rendered tree).

🤖 Generated with Claude Code

…JS-0820)

Both rules-of-hooks violations were Storybook patterns where hooks ran in a
story `render` callback / a decorator function — valid at Storybook runtime
(it renders them as components) but flagged by the react-hooks rule because
the function isn't a capitalized component. Fixed honestly (the recommended
Storybook pattern) rather than suppressed:
- stories/Tabs.stories.tsx: `useState` extracted into a `WithPanelsDemo`
  component; the story render returns `<WithPanelsDemo />`.
- .storybook/preview.tsx: the theme `useEffect` extracted into a
  `ThemeWrapper` component (theme/appearance passed as props); `withTheme`
  decorator renders `<ThemeWrapper>…<Story/></ThemeWrapper>`.

Rendered output unchanged. lint + typecheck green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldscript-studio Ready Ready Preview, Comment Jun 24, 2026 3:05pm

@deepsource-io

deepsource-io Bot commented Jun 24, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in c7c5752...ba4dce5 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Docker Jun 24, 2026 3:04p.m. Review ↗
JavaScript Jun 24, 2026 3:04p.m. Review ↗
CSS Jun 24, 2026 3:04p.m. Review ↗
Rust Jun 24, 2026 3:04p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@qnbs

qnbs commented Jun 24, 2026

Copy link
Copy Markdown
Owner Author

@deepsourcebot review

qnbs added a commit that referenced this pull request Jun 24, 2026
…grounded)

Per the DeepSource docs, AI review needs AI Agents enabled (dashboard →
Policies → AI → "Enable AI Agents"); inline AI findings via Settings →
Quality Gates. Observed 2026-06-24: `@deepsourcebot review` produced no
response on #231/#232/#233 (AI Agents off / not on the OSS tier), so the
runbook now treats the AI review as BEST-EFFORT — always trigger it, but
gate merges on static-analysis quiescence (the reliable layer), same posture
as the CodeAnt-unresponsive rule. Also restores the §1 header (lost in the
§0a insertion) and logs the repo-wide triage + AI-review observation in §11.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@qnbs qnbs merged commit 2ae63aa into main Jun 24, 2026
22 checks passed
@qnbs qnbs deleted the fix/deepsource-storybook-hooks branch June 24, 2026 15:52
qnbs added a commit that referenced this pull request Jun 24, 2026
…ilable on free tier

AI Review (@deepsourcebot review) requires AI Agents (dashboard → Policies → AI),
a paid/team feature absent on the free OSS plan — verified zero response on
#231/#232/#233. Reverse the prior always-trigger rule: do not post the trigger;
gate merges on the static-analysis layer's quiescence (auto-runs on every push).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
qnbs added a commit that referenced this pull request Jun 24, 2026
* docs(deepsource): codify always-trigger AI review on every PR (§0a)

DeepSource runs two layers: static analysis (auto on push) and AI Review
(on-demand for this team). The runbook now mandates triggering
`@deepsourcebot review` on every PR + after each code-changing push, and the
§1 table / §2 loop / Consequence note are corrected to distinguish the
auto static re-run from the manual AI-review trigger.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(deepsource): AI-review prerequisite + best-effort posture (docs-grounded)

Per the DeepSource docs, AI review needs AI Agents enabled (dashboard →
Policies → AI → "Enable AI Agents"); inline AI findings via Settings →
Quality Gates. Observed 2026-06-24: `@deepsourcebot review` produced no
response on #231/#232/#233 (AI Agents off / not on the OSS tier), so the
runbook now treats the AI review as BEST-EFFORT — always trigger it, but
gate merges on static-analysis quiescence (the reliable layer), same posture
as the CodeAnt-unresponsive rule. Also restores the §1 header (lost in the
§0a insertion) and logs the repo-wide triage + AI-review observation in §11.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(deepsource): remove AI-review trigger rule — paid feature, unavailable on free tier

AI Review (@deepsourcebot review) requires AI Agents (dashboard → Policies → AI),
a paid/team feature absent on the free OSS plan — verified zero response on
#231/#232/#233. Reverse the prior always-trigger rule: do not post the trigger;
gate merges on the static-analysis layer's quiescence (auto-runs on every push).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant