fix(embedded): autolayout viewport calculation for resource view#3629
fix(embedded): autolayout viewport calculation for resource view#3629waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace. To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes autolayout viewport calculation in the embedded (resource/MothershipView) context by threading an Key changes:
The logic is sound: zero offsets are returned in embedded mode, which correctly centres the content within the full container rect. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant WC as WorkflowContent
participant UAL as useAutoLayout
participant UCV as useCanvasViewport
participant GVB as getVisibleCanvasBounds
participant DOM as DOM
WC->>UAL: useAutoLayout(workflowId, { embedded })
UAL->>UCV: useCanvasViewport(reactFlowInstance, { embedded })
UCV->>UCV: stableOptions = useMemo(() => embedded ? { embedded } : undefined, [embedded])
Note over WC: User triggers auto-layout
WC->>UAL: handleAutoLayout()
UAL->>UAL: applyAutoLayoutAndUpdateStore()
UAL->>UCV: fitViewToBounds({ padding, duration })
UCV->>GVB: getVisibleCanvasBounds(stableOptions)
alt embedded === true
GVB->>DOM: querySelector('.react-flow')
DOM-->>GVB: flowContainer
GVB->>DOM: getBoundingClientRect()
DOM-->>GVB: { width, height, left, top }
GVB-->>UCV: { width, height, offsetLeft: 0, offsetRight: 0, offsetBottom: 0 }
else not embedded
GVB->>DOM: getComputedStyle (CSS vars)
DOM-->>GVB: --sidebar-width, --terminal-height, --panel-width
GVB-->>UCV: adjusted bounds with CSS offsets
end
UCV->>UCV: calculate zoom & viewport position
UCV->>DOM: reactFlowInstance.setViewport({ x, y, zoom })
|
|
You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace. To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard. |
Summary
embeddedflag through viewport calculation so embedded workflows use container rect directlyType of Change
Testing
Tested manually
Checklist