feat(canvas): add a setting to turn off auto-focus when clicking blocks - #6685
Conversation
Clicking a block animates the camera to center it, which zooms in far enough that you lose sight of the rest of the workflow. Add an "Auto-focus on click" preference (on by default, so existing behavior is unchanged) that keeps the camera still on click. Also re-record the auto-connect and canvas-error-notification tooltip previews and re-encode all three at a smaller size.
…tooltips Gating the whole click branch on the setting also skipped the userFocusedWorkflowIdRef write, which is what stops <ReactFlow onInit> from running fitView over the user's framing. That would have blown away the framing of exactly the users who turned auto-focus off to keep it. Mark the workflow as user-framed on any plain node click and gate only the camera move. Crop the auto-focus preview to the recording's viewport center so the blocks are legible at the 240px width Tooltip.Preview renders at, and trim the 2.45s of empty lead off the error-notification preview.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview The preference is stored as Arrow-key navigation, new-block placement, and note expand still move the camera as before; only the click path is gated. Reviewed by Cursor Bugbot for commit 53681fb. Configure here. |
Greptile SummaryThe PR adds a persisted, default-enabled preference that lets users disable camera auto-focus when clicking canvas blocks.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/hooks/queries/general-settings.ts | Adds the preference mapping and hook; the revised TSDoc accurately documents its click-only scope and intentional exclusions. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx | Gates plain-click camera focusing with the new preference while preserving existing keyboard-navigation and block-creation behavior. |
| apps/sim/app/workspace/[workspaceId]/settings/components/general/general.tsx | Adds the default-enabled General Settings switch and explanatory tooltip. |
| apps/sim/lib/api/contracts/user.ts | Extends the user-settings response and update contracts with the boolean preference. |
| apps/sim/lib/users/queries.ts | Includes the preference in default, selected, and normalized user settings. |
| packages/db/migrations/0290_settings_auto_focus_on_click.sql | Adds the non-null preference column with a backward-compatible true default. |
| packages/db/schema.ts | Adds the corresponding default-enabled boolean field to the settings schema. |
Reviews (2): Last reviewed commit: "docs(canvas): correct useAutoFocusOnClic..." | Re-trigger Greptile
The TSDoc claimed the preference also gated arrow-key navigation, which calls focusBlockInView without consulting it. State the click-only scope and why arrow-key navigation and block creation are excluded.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 53681fb. Configure here.
Summary
focusBlockInViewcall inhandleNodeClick.userFocusedWorkflowIdRefis still marked on every plain node click — it's what stops<ReactFlow onInit>from runningfitViewover your framing, so skipping it would have blown away the framing of exactly the people who turned the setting off to keep it.auto_focus_on_clickcolumn (additive, non-null defaulttrue), threaded through the existing user-settings contract, query, and React Query hook. No new API surface — the PATCH route already spreads the validated body into the upsert.Scope worth a second opinion
focusBlockInViewhas three callers. This gates the click path only. Deliberately left alone:note-block.tsx) — fires on the second click, pans at the current zoom rather than zooming, and exists so an expanded note isn't half off-screen.Each of those is unchanged behavior, so this PR can't regress them. Happy to widen the setting to cover them if reviewers disagree.
Type of Change
Testing
Tested manually.
type-check,check:api-validation, andcheck:migrationspass; canvas suite green (349 tests). Tooltip clips were rendered at the 240px widthTooltip.Previewactually uses and inspected frame by frame.Checklist