Skip to content

[pull] main from tldraw:main - #710

Merged
pull[bot] merged 3 commits into
code:mainfrom
tldraw:main
Aug 23, 2026
Merged

[pull] main from tldraw:main#710
pull[bot] merged 3 commits into
code:mainfrom
tldraw:main

Conversation

@pull

@pull pull Bot commented Aug 23, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

frolic and others added 3 commits August 23, 2026 17:56
)

Our internal tldraw.dev smoke test (tldraw-internal "Dotdev test")
crawls the live site and has been red for days on several docs-owned
pages. This fixes the four docs-side causes.

- **`/starter-kits/overview` hydration failure (React #418):** `Feature`
wrapped its MDX children in a `<p>`, but MDX renders block children as
their own `<p>`s — the nested `<p><p>` gets flattened by the HTML parser
and hydration mismatches. The wrapper is now a `<div>`.
- **Intermittent hydration failure on any page with a tldraw.com link
(seen on `/starter-kits/shader`):** `TldrawLink` read posthog's
session/distinct ids during the first client render, so when posthog
loaded before hydration the client href already had `#session_id=…`
appended while the server HTML didn't. The ids now start empty and are
read in an effect.
- **`Invalid URL: %C2%A0` console errors on `/reference/store/AtomMap`,
`AtomSet`, `ReadonlySharedStyleMap`:** `getApiMarkdown` emits method
headings as `name( )`, and for `[Symbol.iterator]` that produces
`[Symbol.iterator]( )` — which markdown parses as a *link* whose href is
a non-breaking space. Square brackets in member names are now escaped.
(Note: these pages' member heading anchors change slightly since the
heading text changes.)
- **404 on `/starter-kits/agent`:** the architecture diagram used a
literal JSX `<img src="/images/…">`, which bypasses the MDX `img →
Image` mapping and its `assetUrl` prefixing, so behind the tldraw.dev
proxy it resolved against the marketing app and 404'd. Converted to a
markdown image like the sibling starter-kit chart diagrams (it now gets
the standard full-width image plate instead of the 400px centered
styling).
- **404 fonts on `/examples/custom-theme`:** the example hardcoded Comic
Neue **v8** gstatic URLs, which Google retired. Bumped to the current v9
URLs (both verified 200) and left a comment on how to refresh them next
time they rot.

### Change type

- [x] `bugfix`

### Release notes

- Fixed hydration errors, broken reference-page member links, a missing
starter-kit image, and stale font URLs on tldraw.dev docs pages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…0534)

This PR makes `exportBackground` default to `true` in a single place.
Closes #10521.

### Before

`TLInstance`'s `withDefaultProperties` declared `exportBackground:
false`, while `createIntegrityChecker` in `TLStore.ts` passed an
explicit `exportBackground: true` when it created the instance record
for a fresh tab. The explicit value won, so every fresh tab started with
the background on ("Transparent" unchecked), but any other caller that
created the instance record without the field would have started with
the opposite value.

### After

The record type's default is `exportBackground: true`, and the integrity
checker no longer passes the field. `RecordType.create` spreads
`createDefaultProperties()` first and only overrides keys whose value is
not `undefined`, so the fresh-tab behavior is unchanged; the default now
just lives in one place.

### Implementation notes

Background on (Transparent unchecked) was chosen as the intended default
because it is what every fresh tab already gets today. The legacy
snapshot path in `extractSessionStateFromLegacySnapshot` still coerces a
missing field with `!!`, which is untouched here because old snapshots
always carried the field after the `AddExportBackground` migration.

### Change type

- [x] `improvement`

### Test plan

- [x] Unit tests — new `should default exportBackground to true when the
instance omits it` in `packages/tlschema/src/TLStore.test.ts` fails on
`main` (`false`) and passes here. The existing `should create missing
instance state` test now exercises the record default instead of the
explicit value and still passes.
1. Open a fresh tab, open the export menu, and confirm "Transparent" is
unchecked.

### Release notes

- Make `exportBackground` default to `true` in one place in
`@tldraw/tlschema`

### Code changes

| Section   | LOC change |
| --------- | ---------- |
| Core code | +1 / -2    |
| Tests     | +9 / -1    |
…hidden (#10526)

This PR fixes a bug where up to 350 ms of edits were lost when a tab was
closed, reloaded, or backgrounded. Closes #10513.

### Before

`TLLocalSyncClient` throttles IndexedDB writes with a 350 ms timer and
nothing flushed the queue when the page went away. Any change made
inside that window, including the final characters typed into a note or
the last slice of a drag, never reached the database.

### After

The client listens for `pagehide` on `window` and for `visibilitychange`
→ `hidden` on `document`, and on either event calls the persist path
immediately, bypassing the throttle timer. The throttle itself is
unchanged for normal editing. The listeners are registered in the
client's disposables and removed on `close()`.

### Implementation notes

- `visibilitychange` is included because mobile browsers often discard a
backgrounded page without firing `pagehide`; it also means switching
tabs on desktop flushes early, which is harmless.
- The flush is a no-op until the initial load has finished. The first
write after connecting is always a full snapshot, so flushing before
load would overwrite the saved document with an empty store (for
example, a background tab closed before IndexedDB responded). A
`didLoad` flag guards this.
- If a write is already in flight when the event fires, the flush does
nothing more; the in-flight transaction is the best we can do at that
point. IndexedDB transactions started during `pagehide` generally
complete.

### Change type

- [x] `bugfix`

### Test plan

- [x] Unit tests — `TLLocalSyncClient.test.ts`: `pagehide flushes
pending changes without waiting for the throttle` and `hiding the tab
flushes pending changes without waiting for the throttle` fail on `main`
and pass here; plus tests that nothing is written before the initial
load and that listeners are removed on `close()`.
1. Open `/develop`, type into a note, and close the tab within a quarter
second. Reopen: the last characters are present.
2. Reload mid-drag: the shape is at its last dragged position rather
than an earlier intermediate one.

### Release notes

- Fix edits made in the last 350 ms before closing or reloading a tab
being lost from local persistence.

### Code changes

| Section   | LOC change |
| --------- | ---------- |
| Core code | +24 / -0   |
| Tests     | +56 / -0   |
@pull pull Bot locked and limited conversation to collaborators Aug 23, 2026
@pull pull Bot added the ⤵️ pull label Aug 23, 2026
@pull
pull Bot merged commit 53900ea into code:main Aug 23, 2026
4 of 7 checks passed
@pull
pull Bot had a problem deploying to deploy-production August 23, 2026 21:13 Failure
@pull
pull Bot requested a deployment to deploy-staging August 23, 2026 21:13 Queued
@pull
pull Bot had a problem deploying to vsce publish August 23, 2026 21:13 Failure
@pull
pull Bot had a problem deploying to deploy-staging August 23, 2026 21:13 Failure
@pull
pull Bot had a problem deploying to deploy-staging August 24, 2026 01:15 Failure
@pull
pull Bot deployed to e2e-dotcom August 24, 2026 02:48 Active
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants