Skip to content

fix(crop): prevent isCircle from leaking onto custom shape crops#7931

Merged
steveruizok merged 1 commit intomainfrom
fix-crop-isCircle
Feb 14, 2026
Merged

fix(crop): prevent isCircle from leaking onto custom shape crops#7931
steveruizok merged 1 commit intomainfrom
fix-crop-isCircle

Conversation

@steveruizok
Copy link
Copy Markdown
Collaborator

@steveruizok steveruizok commented Feb 14, 2026

In order to fix custom croppable shapes crashing when cropped (#7927), this PR prevents getCropBox from adding isCircle: undefined to the result crop object.

The isCircle property was introduced for circle crops on image shapes. However, getCropBox was unconditionally copying it onto every result crop via isCircle: crop.isCircle. When the input crop didn't have isCircle set, this produced { isCircle: undefined } — and Object.keys() includes keys with undefined values. Custom shapes with their own crop validators (without an isCircle field) would then fail with ValidationError: Unexpected property at isCircle.

The fix only copies isCircle when it was explicitly set on the input crop (!= null).

Closes #7927
Based on the fix from #7926 by @jamesbvaughan.

Change type

  • bugfix

Test plan

  1. Create a custom croppable shape without isCircle in its crop validator
  2. Crop the shape — should no longer crash
  • Unit tests

Release notes

  • Fixed a crash when cropping custom shapes that don't include isCircle in their crop schema

Note

Low Risk
Small, localized change to crop serialization plus added tests; main risk is minor behavior change for callers that implicitly relied on isCircle always being present.

Overview
Fixes a cropping regression where getCropBox would always copy crop.isCircle into the returned crop object, causing isCircle: undefined to appear and break custom shape crop validators.

getCropBox now only includes isCircle in the output when it’s explicitly set (non-null/undefined) on the input crop, and new unit tests cover absence/undefined cases plus validation against a custom crop schema without isCircle.

Written by Cursor Bugbot for commit b6c7164. This will update automatically on new commits. Configure here.

getCropBox was always setting `isCircle: crop.isCircle` on the result,
which added `isCircle: undefined` for shapes without that property.
This caused custom croppable shapes to crash with a validation error
("Unexpected property") when their crop validator didn't include isCircle.

Only copy isCircle onto the new crop when it was explicitly set.

Co-Authored-By: James Vaughan <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Feb 14, 2026 9:50pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Feb 14, 2026 9:50pm
chat-template Ignored Ignored Feb 14, 2026 9:50pm
tldraw-docs Ignored Ignored Feb 14, 2026 9:50pm
tldraw-shader Ignored Ignored Feb 14, 2026 9:50pm
workflow-template Ignored Ignored Feb 14, 2026 9:50pm

Request Review

@steveruizok steveruizok added the sdk-hotfix-please ⚙️ Triggers SDK hotfix release after merge label Feb 14, 2026
@steveruizok steveruizok added this pull request to the merge queue Feb 14, 2026
Merged via the queue into main with commit 3c3dbec Feb 14, 2026
26 checks passed
@steveruizok steveruizok deleted the fix-crop-isCircle branch February 14, 2026 22:03
huppy-bot bot pushed a commit that referenced this pull request Feb 14, 2026
In order to fix custom croppable shapes crashing when cropped (#7927),
this PR prevents `getCropBox` from adding `isCircle: undefined` to the
result crop object.

The `isCircle` property was introduced for circle crops on image shapes.
However, `getCropBox` was unconditionally copying it onto every result
crop via `isCircle: crop.isCircle`. When the input crop didn't have
`isCircle` set, this produced `{ isCircle: undefined }` — and
`Object.keys()` includes keys with `undefined` values. Custom shapes
with their own crop validators (without an `isCircle` field) would then
fail with `ValidationError: Unexpected property` at `isCircle`.

The fix only copies `isCircle` when it was explicitly set on the input
crop (`!= null`).

Closes #7927
Based on the fix from #7926 by @jamesbvaughan.

### Change type

- [x] `bugfix`

### Test plan

1. Create a custom croppable shape without `isCircle` in its crop
validator
2. Crop the shape — should no longer crash

- [x] Unit tests

### Release notes

- Fixed a crash when cropping custom shapes that don't include
`isCircle` in their crop schema

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Small, localized change to crop serialization plus added tests; main
risk is minor behavior change for callers that implicitly relied on
`isCircle` always being present.
> 
> **Overview**
> Fixes a cropping regression where `getCropBox` would always copy
`crop.isCircle` into the returned crop object, causing `isCircle:
undefined` to appear and break custom shape crop validators.
> 
> `getCropBox` now only includes `isCircle` in the output when it’s
explicitly set (non-null/undefined) on the input crop, and new unit
tests cover absence/undefined cases plus validation against a custom
crop schema without `isCircle`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b6c7164. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: James Vaughan <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Feb 16, 2026
In order to keep release documentation current after the v4.3.2 patch
release, this PR updates both the archived and next release notes.

### Changes

**v4.3.0.mdx:**
- Add GitHub release link for v4.3.0
- Add v4.3.1 patch section (draw shape delta encoding precision fix)
- Add v4.3.2 patch section (custom shape crop fix)

**next.mdx:**
- Update `last_version` from v4.3.1 to v4.3.2
- Add bug fix entries for #7938 (paste-into-frame) and #7931 (crop
isCircle)

### Change type

- [x] `docs`

### Test plan

- [ ] Verify release notes render correctly on the docs site

### Release notes

- Update release notes with v4.3.1 and v4.3.2 patch entries

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-only updates to markdown release notes; no runtime code changes,
with minimal risk beyond potential formatting/rendering issues.
> 
> **Overview**
> Updates release documentation to reflect the `v4.3.2` patch.
> 
> Bumps `apps/docs/content/releases/next.mdx` `last_version` to `v4.3.2`
and adds two new bug-fix entries (paste-into-frame parenting and a
custom-shape cropping crash).
> 
> Extends `apps/docs/content/releases/v4.3.0.mdx` with GitHub release
links and a new **Patch releases** section covering `v4.3.1` and
`v4.3.2`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ee7dc07. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
huppy-bot bot pushed a commit that referenced this pull request Feb 16, 2026
In order to keep release documentation current after the v4.3.2 patch
release, this PR updates both the archived and next release notes.

### Changes

**v4.3.0.mdx:**
- Add GitHub release link for v4.3.0
- Add v4.3.1 patch section (draw shape delta encoding precision fix)
- Add v4.3.2 patch section (custom shape crop fix)

**next.mdx:**
- Update `last_version` from v4.3.1 to v4.3.2
- Add bug fix entries for #7938 (paste-into-frame) and #7931 (crop
isCircle)

### Change type

- [x] `docs`

### Test plan

- [ ] Verify release notes render correctly on the docs site

### Release notes

- Update release notes with v4.3.1 and v4.3.2 patch entries

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-only updates to markdown release notes; no runtime code changes,
with minimal risk beyond potential formatting/rendering issues.
> 
> **Overview**
> Updates release documentation to reflect the `v4.3.2` patch.
> 
> Bumps `apps/docs/content/releases/next.mdx` `last_version` to `v4.3.2`
and adds two new bug-fix entries (paste-into-frame parenting and a
custom-shape cropping crash).
> 
> Extends `apps/docs/content/releases/v4.3.0.mdx` with GitHub release
links and a new **Patch releases** section covering `v4.3.1` and
`v4.3.2`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ee7dc07. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix sdk-hotfix-please ⚙️ Triggers SDK hotfix release after merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom shape cropping is broken

1 participant