Mark Tolmacs 45276e6a94 refactor(element): place skeleton bound arrows once each, per arrow
Review finding 8.

The placement pass in `convertToExcalidrawElements` simulated moving every
bindable element (`updateBoundElements` per bindable) and repurposed
`simultaneouslyUpdated` as an "already placed" ledger (a fresh copy per
call to dodge the id-set cache), then re-collected the arrows each call
touched for the label loop. Its correctness hinged on `updateBoundElements`
internals: updating both ends from either one, the `doesNeedUpdate` stale
`boundElements` filter, and the array-identity id cache. It already broke
once (fdc8262d5).

Reproduction / evidence: a scratch vitest dumped the output (minus seeds,
nonces and timestamps, versions kept) of `convertToExcalidrawElements` for
arrows bound across two shapes, to the same shape at both ends (2- and
4-point), elbow arrows (one and two ends bound), arrows in frames, six
arrows on one labelled hub, text ends with ids referenced before the
elements, and multi-point arrows, and spied on `movePoints`. Every bound
arrow was placed exactly once.

Failure case: none found. Skeleton bindings all go through `applyBinding`,
which always lists the arrow on the bindable, so the ledger never skipped
or double-placed an arrow. This is a maintainability fix.

Fix: extract the per-arrow body of `updateBoundElements`' visitor into an
exported `updateBoundArrow` (`updateBoundPoint` for each binding, then
`movePoints` with `moveMidPointsWithElement` for arrows bound to one
element at both ends, then `handleBindTextResize`), and call it from
`updateBoundElements`. Dropped the visitor's per-binding `changedElement`
check: after `doesNeedUpdate`, one end is always bound to `changedElement`,
so it always held. The transform pass now iterates the arrows bound to
elements present and places each once, re-deriving its label's
`labelPosition` and x/y in the same loop. No ledger, no copies of it, no
per-bindable calls. Outputs of the scratch dump, versions included, are
byte-identical before and after; all existing tests and snapshots pass
unchanged.
2026-10-23 15:09:58 +00:00
2024-08-06 13:21:20 +02:00
2020-04-03 19:19:01 +02:00
2024-09-09 17:12:07 +02:00
2020-09-15 21:59:00 +02:00
2025-05-25 21:23:40 +02:00
2023-05-18 16:06:27 +02:00
2025-05-25 21:23:40 +02:00
2020-01-05 13:09:29 -08:00

Excalidraw

Excalidraw Editor | Blog | Documentation | Excalidraw+

An open source virtual hand-drawn style whiteboard.
Collaborative and end-to-end encrypted.


Excalidraw is released under the MIT license. npm downloads/month PRs welcome! Chat on Discord Ask DeepWiki Follow Excalidraw on Twitter

Product showcase

Create beautiful hand-drawn like diagrams, wireframes, or whatever you like.

Features

The Excalidraw editor (npm package) supports:

  • 💯 Free & open-source.
  • 🎨 Infinite, canvas-based whiteboard.
  • ✍️ Hand-drawn like style.
  • 🌓 Dark mode.
  • 🏗️ Customizable.
  • 📷 Image support.
  • 😀 Shape libraries support.
  • 🌐 Localization (i18n) support.
  • 🖼️ Export to PNG, SVG & clipboard.
  • 💾 Open format - export drawings as an .excalidraw json file.
  • ⚒️ Wide range of tools - rectangle, circle, diamond, arrow, line, free-draw, eraser...
  • ➡️ Arrow-binding & labeled arrows.
  • 🔙 Undo / Redo.
  • 🔍 Zoom and panning support.

Excalidraw.com

The app hosted at excalidraw.com is a minimal showcase of what you can build with Excalidraw. Its source code is part of this repository as well, and the app features:

  • 📡 PWA support (works offline).
  • 🤼 Real-time collaboration.
  • 🔒 End-to-end encryption.
  • 💾 Local-first support (autosaves to the browser).
  • 🔗 Shareable links (export to a readonly link you can share with others).

We'll be adding these features as drop-in plugins for the npm package in the future.

Quick start

Note: following instructions are for installing the Excalidraw npm package when integrating Excalidraw into your own app. To run the repository locally for development, please refer to our Development Guide.

Use npm or yarn to install the package.

npm install react react-dom @excalidraw/excalidraw
# or
yarn add react react-dom @excalidraw/excalidraw

Check out our documentation for more details!

Contributing

Integrations

Who's integrating Excalidraw

Google Cloud • Meta • CodeSandbox • Obsidian Excalidraw • Replit • Slite • Notion • HackerRank • and many others

Sponsors & support

If you like the project, you can become a sponsor at Open Collective or use Excalidraw+.

Thank you for supporting Excalidraw

Last but not least, we're thankful to these companies for offering their services for free:

Vercel Sentry Crowdin

Languages
TypeScript 94.1%
SCSS 2.5%
JavaScript 1.6%
MDX 1.4%
HTML 0.4%