Repository navigation
refactor(sql-editor): extract snippet-identity/mount/prettify/title hooks (decompose 3b/6) - #47893
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughChangesSQLEditor now uses dedicated hooks for snippet identity, editor mounting, AI title generation, and query prettification. Diff cleanup and scroll persistence use effect-event handlers instead of inline lifecycle logic. SQLEditor behavior refactor
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🎭 Playwright Test Results (tanstack)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
1971ee5 to
7667bfb
Compare
13d0915 to
d6cfb98
Compare
d6cfb98 to
3c385dc
Compare
There was a problem hiding this comment.
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 `@apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx`:
- Around line 635-646: Update saveScrollPosition to accept the tab identifier as
a parameter while continuing to read the latest ref and tabs values; in the
useEffect cleanup, return an arrow closure that passes the effect’s captured id
to saveScrollPosition, preserving the departing snippet’s tab when switching
ids.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 64c9cc98-3258-4cc4-ae10-fa12fbd01abf
📒 Files selected for processing (5)
apps/studio/components/interfaces/SQLEditor/SQLEditor.tsxapps/studio/components/interfaces/SQLEditor/useEditorMount.tsapps/studio/components/interfaces/SQLEditor/usePrettifyQuery.tsapps/studio/components/interfaces/SQLEditor/useSnippetIdentity.tsapps/studio/components/interfaces/SQLEditor/useSnippetTitleGenerator.ts
…e hooks Pulls four cohesive concerns out of the SQLEditor composition root into co-located hooks: useSnippetIdentity (id/name/loading derivation), useEditorMount (onMount + mount counter), usePrettifyQuery, and useSnippetTitleGenerator (title mutation + setAiTitle). Behavior-preserving; the characterization suite stays green. PR 3b of the SQLEditor decomposition stack.
3c385dc to
1324f12
Compare
Braintrust eval report
|
…ooks (decompose 3b/6) (#47893) ## Summary Continues the SQLEditor decomposition. Pulls four cohesive concerns out of the `SQLEditorContent` composition root into co-located `use*` hooks. ## New hooks - `useSnippetIdentity` — derives `id` / `generatedNewSnippetName` / `isLoading` from the URL + snippet store (keeps the `[urlId]` memo dep verbatim). - `useEditorMount` — the editor `onMount` (scroll restore/track) + the mount counter that lets a pre-mount diff request re-run. - `usePrettifyQuery` — formats the editor SQL in place and writes it back to the store. - `useSnippetTitleGenerator` — the title-generation mutation + `setAiTitle`.
Summary
Continues the SQLEditor decomposition. Pulls four cohesive concerns out of the
SQLEditorContentcomposition root into co-locateduse*hooks.New hooks
useSnippetIdentity— derivesid/generatedNewSnippetName/isLoadingfrom the URL + snippet store (keeps the[urlId]memo dep verbatim).useEditorMount— the editoronMount(scroll restore/track) + the mount counter that lets a pre-mount diff request re-run.usePrettifyQuery— formats the editor SQL in place and writes it back to the store.useSnippetTitleGenerator— the title-generation mutation +setAiTitle.Summary by CodeRabbit
New Features
Improvements