Title: improvement(emcn): let a modal refuse every dismissal while an action runs by waleedlatif1 · Pull Request #6276 · simstudioai/sim · GitHub
Open Graph Title: improvement(emcn): let a modal refuse every dismissal while an action runs by waleedlatif1 · Pull Request #6276 · simstudioai/sim
X Title: improvement(emcn): let a modal refuse every dismissal while an action runs by waleedlatif1 · Pull Request #6276 · simstudioai/sim
Description: Summary ChipModal / ModalContent take dismissDisabled, which holds all four exits shut while an action is in flight: Escape, outside-click, the header close button, and the footer Cancel ChipConfirmModal now passes dismissDisabled={confirm.pending}, making its TSDoc true — it promised "a single dismiss path shared by the header X / dismiss button / Escape … and disabling dismiss while the confirm is in flight", but only the dismiss button was ever guarded Fixes two live bugs: edit-connector-modal and add-connector-modal guarded onOpenChange against a pending save, then handed the header X a direct onOpenChange(false) that skipped the guard — you could close them mid-save via the X Turns on turbo run type-check for every workspace (was --filter=@sim/realtime only) Why the guard lives in ModalContent {...props} is spread after that component's own handlers, so a consumer-passed onEscapeKeyDown / onInteractOutside would silently drop the floating-layer guard whose comment explains it prevents a frozen-page bug. The flag is published through a context that ChipModalHeader, ChipModalFooter and ModalHeader read, so ModalHeader's built-in DialogPrimitive.Close is covered too — otherwise the five non-ChipModal consumers would get a modal that traps Escape and outside-click but still closes on X. closeDisabled / cancelDisabled compose with ||, matching ButtonGroupItem's precedent: an explicit true still disables one button, an explicit false cannot re-enable a button whose click Radix has already been told to ignore. All 60 existing ChipModalHeader sites and 28 cancelDisabled consumers are unaffected. Type-check gate All 23 workspaces pass today, so it lands green. packages/emcn, packages/utils, apps/desktop and apps/docs had no type check in CI; apps/sim's source was covered only as a side effect of next build. Added inputs to the turbo task so non-TS changes stop busting the cache. This does not cover apps/sim's tests — its tsconfig excludes *.test.ts(x), and including them surfaces ~2.2k errors. That's its own cleanup, not a gate to switch on here. Testing packages/emcn/src/components/chip-modal/chip-modal.test.tsx covers the buttons, Escape, both composition directions, and ChipConfirmModal's pending state. Each assertion verified to fail with the guard reverted. Checked all 62 ChipConfirmModal usages for a pending flag that could stick — the change removes Escape as an escape hatch, so a flag that never resets would trap the user. Every manual useState flag resets in a finally; the rest use React Query's .isPending. None can strand. Not covered: outside-click is guarded by the same flag but is not asserted — jsdom cannot drive Radix's outside-interaction path, so the assertion could never fail. It's code-reviewed only. Nothing here has been opened in a browser. Follow-ups (not in this PR) 29 modals still pass cancelDisabled={pending} alone, leaving Escape and outside-click open. Each needs its pending source verified, so it's a separate reviewed change rather than a blind sweep ModalContent.showClose is destructured and never read — ChipModal passes showClose={false} believing it does something. Pre-existing no-op deploy-modal's chatSubmitting is the most fragile consumer: three early returns inside its try, correct only because finally resets it Type of Change Bug fix Improvement 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 ChipModal / ModalContent take dismissDisabled, which holds all four exits shut while an action is in flight: Escape, outside-click, the header close button, and the footer Cancel ChipConfi...
X Description: Summary ChipModal / ModalContent take dismissDisabled, which holds all four exits shut while an action is in flight: Escape, outside-click, the header close button, and the footer Cancel ChipConfi...
Opengraph URL: https://github.com/simstudioai/sim/pull/6276
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:048cded8-e193-03d1-6908-3a097069ef74 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DBE4:47529:8A7285:C459D7:6AFB5083 |
| html-safe-nonce | c9cd0d972c82def40100593c836cb3b0ac1eb926174cc7e0b87d287c8cef92f4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkU0OjQ3NTI5OjhBNzI4NTpDNDU5RDc6NkFGQjUwODMiLCJ2aXNpdG9yX2lkIjoiMTk1ODcwOTA0ODE3NzgwNzQ5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1c9f442815baa9d276d50200ef9fb192c12f9cbc7ab52709c820bffe061f8887 |
| hovercard-subject-tag | pull_request:4208561259 |
| 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/6276/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 ChipModal / ModalContent take dismissDisabled, which holds all four exits shut while an action is in flight: Escape, outside-click, the header close button, and the footer Cancel ChipConfi... |
| 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