Add EmbedShapeOptions to EmbedShapeUtil#8034
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
API Changes Check Passed Great! The PR description now includes the required "### API changes" section. This helps reviewers and SDK users understand the impact of your changes. |
d063260 to
db6a188
Compare
Replace the static mutable embedDefinitions field with the standard
options pattern used by other shape utils. Users can now customize embed
definitions via EmbedShapeUtil.configure({ embedDefinitions: [...] }).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
db6a188 to
98682db
Compare
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
multiplayer-template | d245937 | Feb 28 2026, 01:38 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
agent-template | d245937 | Feb 28 2026, 01:38 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
image-pipeline-template | d245937 | Feb 28 2026, 01:38 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
multiplayer-template | f564ec3 | Mar 10 2026, 11:41 AM |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Static legacy field silently overrides instance
configure()options- Inverted priority order in getEmbedDefs() to check instance options first, then legacy static field, then default, ensuring configure() API always takes precedence over deprecated setEmbedDefinitions().
Or push these changes by commenting:
@cursor push 97986fd932
Preview (97986fd932)
diff --git a/packages/tldraw/api-report.api.md b/packages/tldraw/api-report.api.md
--- a/packages/tldraw/api-report.api.md
+++ b/packages/tldraw/api-report.api.md
@@ -1394,7 +1394,7 @@
// @public (undocumented)
export interface EmbedShapeOptions {
- readonly embedDefinitions: readonly TLEmbedDefinition[];
+ readonly embedDefinitions?: readonly TLEmbedDefinition[];
}
// @public
diff --git a/packages/tldraw/src/lib/shapes/embed/EmbedShapeUtil.tsx b/packages/tldraw/src/lib/shapes/embed/EmbedShapeUtil.tsx
--- a/packages/tldraw/src/lib/shapes/embed/EmbedShapeUtil.tsx
+++ b/packages/tldraw/src/lib/shapes/embed/EmbedShapeUtil.tsx
@@ -39,7 +39,7 @@
/** @public */
export interface EmbedShapeOptions {
/** The embed definitions to use for this shape util. */
- readonly embedDefinitions: readonly TLEmbedDefinition[]
+ readonly embedDefinitions?: readonly TLEmbedDefinition[]
}
/** @public */
@@ -48,9 +48,7 @@
static override props = embedShapeProps
static override migrations = embedShapeMigrations
- override options: EmbedShapeOptions = {
- embedDefinitions: DEFAULT_EMBED_DEFINITIONS,
- }
+ override options: EmbedShapeOptions = {}
override canEditWhileLocked(shape: TLEmbedShape) {
const result = this.getEmbedDefinition(shape.props.url)
@@ -66,7 +64,11 @@
}
private getEmbedDefs(): readonly TLEmbedDefinition[] {
- return EmbedShapeUtil.legacyEmbedDefinitions ?? this.options.embedDefinitions
+ return (
+ this.options.embedDefinitions ??
+ EmbedShapeUtil.legacyEmbedDefinitions ??
+ DEFAULT_EMBED_DEFINITIONS
+ )
}
getEmbedDefinitions(): readonly TLEmbedDefinition[] {There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
followup to #8034 not sure how this passed merge queue ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Updates an examples-only integration to the new embed configuration API; no core logic changes, but the sample could break if the util is misconfigured. > > **Overview** > Updates the `CustomEmbedExample` to use the latest embed configuration approach by configuring `EmbedShapeUtil` with the custom `embedDefinitions` and passing it to `Tldraw` via `shapeUtils`. > > Removes usage of the `embeds` prop on `Tldraw` and adjusts the example’s imports/docs accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 31d6fa5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
In order to publish the v4.5.0 release notes and record the v4.4.1 patch, this PR archives release notes and resets `next.mdx` for the next cycle. **v4.5.0.mdx** (new file): - Archived from `next.mdx` with full frontmatter, keywords, and GitHub release link - Featured sections: click-through on transparent image pixels (#7942), breaking `EmbedShapeUtil.configure()` change (#8034) - API changes: `Editor.getResizeScaleFactor()` (#8042), `TLImageAsset.pixelRatio` (#8163), `sanitizeSvg` (#7896), `experimental__onDropOnCanvas` (#7911), enum-to-const refactoring (#8084) - 6 improvements and 20 bug fixes from production **v4.4.0.mdx:** - Add v4.4.1 patch release section with tooltip positioning fix (#8171) - Add v4.4.1 to keywords **next.mdx:** - Reset with `last_version: v4.5.0` and empty content ### Change type - [x] `other` ### Code changes | Section | LOC change | | ------------- | ------------- | | Documentation | +128 / -107 |
In order to publish the v4.5.0 release notes and record the v4.4.1 patch, this PR archives release notes and resets `next.mdx` for the next cycle. **v4.5.0.mdx** (new file): - Archived from `next.mdx` with full frontmatter, keywords, and GitHub release link - Featured sections: click-through on transparent image pixels (#7942), breaking `EmbedShapeUtil.configure()` change (#8034) - API changes: `Editor.getResizeScaleFactor()` (#8042), `TLImageAsset.pixelRatio` (#8163), `sanitizeSvg` (#7896), `experimental__onDropOnCanvas` (#7911), enum-to-const refactoring (#8084) - 6 improvements and 20 bug fixes from production **v4.4.0.mdx:** - Add v4.4.1 patch release section with tooltip positioning fix (#8171) - Add v4.4.1 to keywords **next.mdx:** - Reset with `last_version: v4.5.0` and empty content ### Change type - [x] `other` ### Code changes | Section | LOC change | | ------------- | ------------- | | Documentation | +128 / -107 |

Summary
We're migrating more to using
options/configureon shapes.EmbedShapeOptionsinterface toEmbedShapeUtil, following the same options pattern used byTextShapeUtil,DrawShapeUtil,FrameShapeUtil, and othersembedDefinitionsfield andsetEmbedDefinitions()with instance-leveloptions.embedDefinitions(defaulting toDEFAULT_EMBED_DEFINITIONS)Tldrawcomponent'sembedsprop to useconfigure()internally instead of mutating static stateUsers can now add, augment, or override the default embed definitions via
configure:Breaking changes
EmbedShapeUtil.setEmbedDefinitions()is deprecated (useconfigure()instead)Test plan
🤖 Generated with Claude Code
Change type
improvementAPI changes
options.embedDefinitionstoEmbedShapeUtilstatic setEmbedDefinitionsNote
Medium Risk
Touches how embed definitions are sourced and configured, which could change behavior when multiple editors/util instances or legacy
embedsusage rely on the previous global static state.Overview
Moves embed definition configuration from global static state on
EmbedShapeUtilto instance-leveloptions.embedDefinitions(defaulting toDEFAULT_EMBED_DEFINITIONS), aligning embeds with the existingconfigure()/options pattern used by other shape utils.Adds a public
EmbedShapeOptionstype export, keepsEmbedShapeUtil.setEmbedDefinitions(...)as deprecated legacy plumbing, and marks theTldrawembedsprop as deprecated in favor of configuringEmbedShapeUtilviaconfigure(); API report and package exports are updated accordingly.Written by Cursor Bugbot for commit f564ec3. This will update automatically on new commits. Configure here.