-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(settings): added snap to grid slider to settings #2504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
217b816 to
b860077
Compare
Greptile SummaryThis PR adds a configurable snap-to-grid feature for the workflow canvas, allowing users to set grid snapping from 0px (off) to 50px through a slider control in settings. Key changes:
Minor issues:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant SettingsUI as Settings Modal
participant Slider as Slider Component
participant Hook as useUpdateGeneralSetting
participant API as Settings API
participant DB as Database
participant Store as Zustand Store
participant Workflow as Workflow Component
User->>SettingsUI: Opens settings modal
SettingsUI->>Hook: useGeneralSettings()
Hook->>API: GET request
API->>DB: SELECT from settings table
DB-->>API: Return user settings
API-->>Hook: Return settings data
Hook->>Store: syncSettingsToZustand()
Store-->>SettingsUI: Display current value
User->>Slider: Drags slider to 20px
Slider->>SettingsUI: onValueChange([20])
SettingsUI->>SettingsUI: setLocalSnapValue(20)
Note over SettingsUI,Slider: Optimistic UI update
User->>Slider: Releases slider
Slider->>SettingsUI: onValueCommit([20])
SettingsUI->>Hook: mutateAsync with new value
Hook->>API: PATCH request
API->>API: Validate with Zod
API->>DB: INSERT or UPDATE settings
DB-->>API: Confirmation
API-->>Hook: Response
Hook->>Store: syncSettingsToZustand()
Store->>Store: Update snapToGridSize
SettingsUI->>SettingsUI: setLocalSnapValue(null)
Store-->>Workflow: snapToGridSize updated
Workflow->>Workflow: useMemo recalculates snapGrid
Workflow->>Workflow: snapToGrid enabled
Note over Workflow: ReactFlow now snaps nodes to grid
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, 3 comments
.../[workspaceId]/w/components/sidebar/components/settings-modal/components/general/general.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually
Checklist