Title: fix(workflow): stop a nested block jumping when it leaves its container by waleedlatif1 · Pull Request #6644 · simstudioai/sim · GitHub
Open Graph Title: fix(workflow): stop a nested block jumping when it leaves its container by waleedlatif1 · Pull Request #6644 · simstudioai/sim
X Title: fix(workflow): stop a nested block jumping when it leaves its container by waleedlatif1 · Pull Request #6644 · simstudioai/sim
Description: Summary getNodeAbsolutePosition added the container's header and padding to a child's position. Those are already in the position — React Flow places a child at its parent's origin plus its own coordinates, and clampPositionToContainer is what holds it clear of the chrome, flooring it at LEFT_PADDING and HEADER_HEIGHT + TOP_PADDING. Counting them twice reported every nested node 16px right and 66px below where it actually renders. What that looks like: A block drops down-right the moment it is dragged out of a Loop. A block dragged into a Loop from the canvas lands off-target. Container hit-testing during a drag, and the bounds fitView focuses on, are both skewed for nested nodes. Two callers already knew something was wrong: each subtracted the same three constants straight back off to recover a relative position. They now take the difference of two absolutes, which is what a relative position is. A third place had its own copy — React Flow's child extent, with a fourth distinct header height (42, against the 40 the card renders and the 50 this helper used). It now reads the same constants as the clamp, so a drag stops where a drop would put it. And positionAbsolute ?? getNodeAbsolutePosition(...) in the fit-view path stops disagreeing with itself: React Flow's own answer carries no offset, so its two branches returned points 66px apart for the same node. Type of Change Bug fix Testing New unit tests on the hook pinning the convention — a child sits at parent-plus-position, a root node is untouched, and popping a child out round-trips to exactly where it was. Two fail on the old helper, with the double-count visible in the diff: expected { x: 32, y: 132 } to deeply equal { x: 16, y: 66 } That is the pop-out case: the block landed 16px right and 66px down instead of staying put. Blast radius is bounded by the helper's own early return — a node with no parent returns its position unchanged, so nothing about top-level blocks changes. Only nested nodes move, and only onto the position they were already being drawn at. Full [workflowId] and lib/workflows suites green (1756 tests), type-check and lint clean across all 23 packages. Not verified on a running canvas. Worth dragging a block out of a Loop and back in before merging — that is the exact interaction this changes. Notes The extent change tightens the drag floor from 42 to HEADER_HEIGHT + TOP_PADDING. Programmatic placement already used the larger floor, so this makes dragging agree with dropping rather than loosening anything. Remaining follow-ups from the subflow work, deliberately not bundled here: the mcp-dynamic-args row estimate, and writing a container's derived size back so the first painted frame is not the stored default. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary getNodeAbsolutePosition added the container's header and padding to a child's position. Those are already in the position — React Flow places a child at its parent's origin plus...
X Description: Summary getNodeAbsolutePosition added the container's header and padding to a child's position. Those are already in the position — React Flow places a child at its parent's...
Opengraph URL: https://github.com/simstudioai/sim/pull/6644
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:53ba8a33-f8c1-aa42-127c-47b43b6bdcb1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C1DE:243FA5:C48685:10DA8B5:6AFB56B5 |
| html-safe-nonce | efc89ced5d023d59a7c1d292210f19b86e175a2f976c9ac87178c6ab97437fd9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMURFOjI0M0ZBNTpDNDg2ODU6MTBEQThCNTo2QUZCNTZCNSIsInZpc2l0b3JfaWQiOiI3NzA1MDYyMDg4MzI1NjgyODY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 81a2486669f913cc9d84b4787b835395c6ed515608025f588a5e335c8860643f |
| hovercard-subject-tag | pull_request:4266317801 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6644/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary getNodeAbsolutePosition added the container's header and padding to a child's position. Those are already in the position — React Flow places a child at its parent's origin plus... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width