Skip to content

Fix undefined IndexedDB result in onupgradeneeded handler - #207

Open
sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/idb-upgradeneeded-target-result
Open

sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/idb-upgradeneeded-target-result

Conversation

@sentry

@sentry sentry Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Fixes TypeError when evaluating db.objectStoreNames during IndexedDB onupgradeneeded.

Changes

  • Use event.target.result instead of open.result in the onupgradeneeded handler (IDB spec compliant).
  • Guard against db being nullish before calling upgrade() so environments where the database is unavailable fail gracefully instead of throwing.
  • Remove inadvertently created package-lock.json to keep bun.lock as the single source of truth.

Fixes SHADER-LAB-1Q

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
shader-lab Ready Ready Preview Oct 16, 2026 10:59pm UTC

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The runtime change stays within browser-side editor storage.

The reported autosave failure needs a working fix before merging.

Summary

Changes onupgradeneeded to read the database through event.target and adds an npm lockfile.

  • The editor gets its database from the upgrade event.

Reviews (1) · Last reviewed commit: "Fix undefined IndexedDB result in onupgr..." · Reviewed by Greptile

Comment thread src/lib/editor/autosave/idb.ts Outdated
Comment on lines +51 to +52
open.onupgradeneeded = (event) =>
upgrade((event.target as IDBOpenDBRequest).result)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Autosave failure remains

event.target is the same request as open, so this still reads the same .result property. The cast changes only TypeScript's view of the value. If open.result is undefined in the reported failure, this passes undefined to upgrade too, leaving local autosave unavailable. Please address the cause of the missing database rather than changing the reference used to read it.

Knowledge Base Used: Draft persistence and recovery

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/editor/autosave/idb.ts
Line: 51-52

Comment:
**Autosave failure remains**

`event.target` is the same request as `open`, so this still reads the same `.result` property. The cast changes only TypeScript's view of the value. If `open.result` is undefined in the reported failure, this passes undefined to `upgrade` too, leaving local autosave unavailable. Please address the cause of the missing database rather than changing the reference used to read it.

**Knowledge Base Used:** [Draft persistence and recovery](https://app.greptile.com/basement/-/custom-context/knowledge-base/basementstudio/shader-lab/-/docs/editor-persistence.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread package-lock.json Outdated
Comment on lines +14599 to +14601
},
"node_modules/@peculiar/asn1-csr": {
"vers

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Dependency versions disagree

The new package-lock.json records different versions from bun.lock: next is 16.4.2 instead of 16.2.3, and @base-ui/react is 1.9.0 instead of 1.3.0. The project declares Bun, and CI installs only bun.lock, so CI does not check this second set of versions. Remove the unrelated npm lockfile to avoid maintaining conflicting dependency versions.

Prompt To Fix With AI
This is a comment left during a code review.
Path: package-lock.json
Line: 14599-14601

Comment:
**Dependency versions disagree**

The new `package-lock.json` records different versions from `bun.lock`: `next` is 16.4.2 instead of 16.2.3, and `@base-ui/react` is 1.9.0 instead of 1.3.0. The project declares Bun, and CI installs only `bun.lock`, so CI does not check this second set of versions. Remove the unrelated npm lockfile to avoid maintaining conflicting dependency versions.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch was successfully deployed

1 active deployment
Preview — 43efed51 Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants