fix(storybook): wrap story/decorator hooks in components (DeepSource JS-0820)#231
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Resolves both JS-0820 (rules-of-hooks, Major) findings — both in Storybook files, where hooks ran in a story
rendercallback / 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→ extractedWithPanelsDemocomponent; story renders<WithPanelsDemo />..storybook/preview.tsx: themeuseEffect→ extractedThemeWrappercomponent (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