Skip to content

fix(editor): fall back to existing currentPageId in loadSessionStateSnapshotIntoStore#7994

Merged
mimecuvalo merged 1 commit intomainfrom
mime/fix-session-state-currentPageId
Feb 18, 2026
Merged

fix(editor): fall back to existing currentPageId in loadSessionStateSnapshotIntoStore#7994
mimecuvalo merged 1 commit intomainfrom
mime/fix-session-state-currentPageId

Conversation

@mimecuvalo
Copy link
Copy Markdown
Member

@mimecuvalo mimecuvalo commented Feb 18, 2026

Closes #7993

loadSessionStateSnapshotIntoStore crashes with a ValidationError when a session state snapshot without currentPageId is loaded (e.g. via deep links in dotcom). This happens because currentPageId is passed as undefined to the instance validator, which rejects it.

The fix falls back to the existing instance's currentPageId when the snapshot doesn't include one, consistent with how the other fields in the function already use ?? fallbacks. Note that pluckPreservingValues deliberately excludes currentPageId (since the page may no longer exist), so we read it directly from the existing instance record instead.

Change type

  • bugfix

Test plan

  1. Open a file on tldraw.com with a ?d= deep link parameter
  2. Have a saved lastSessionState in the file state
  3. Refresh the page — should no longer crash
  • Unit tests

Release notes

  • Fix a crash when loading session state without a currentPageId (e.g. when using deep links).

Note

Low Risk
Small, localized change to snapshot-loading fallback behavior with a focused regression test; minimal impact outside this edge case.

Overview
Prevents a crash when loading a TLSessionStateSnapshot that omits currentPageId (e.g. deep-link flows).

loadSessionStateSnapshotIntoStore now falls back to the existing instance record’s currentPageId when the snapshot doesn’t provide one, and a unit test was added to ensure the page id is preserved in this scenario.

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

…napshotIntoStore

When a session state snapshot without currentPageId is loaded (e.g. via
deep links in dotcom), the function now falls back to the existing
instance's currentPageId instead of passing undefined to the validator.
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 18, 2026

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

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Feb 18, 2026 10:25am
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Feb 18, 2026 10:25am
chat-template Ignored Ignored Preview Feb 18, 2026 10:25am
tldraw-docs Ignored Ignored Preview Feb 18, 2026 10:25am
tldraw-shader Ignored Ignored Preview Feb 18, 2026 10:25am
workflow-template Ignored Ignored Preview Feb 18, 2026 10:25am

Request Review

@huppy-bot huppy-bot bot added the bugfix Bug fix label Feb 18, 2026
@mimecuvalo mimecuvalo enabled auto-merge February 18, 2026 10:26
@mimecuvalo mimecuvalo added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit fd32dfb Feb 18, 2026
21 checks passed
@mimecuvalo mimecuvalo deleted the mime/fix-session-state-currentPageId branch February 18, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loadSessionStateSnapshotIntoStore crashes when currentPageId is undefined

1 participant