[Fix] Code-editor null guards for Sentry tier 2 errors#2012
Merged
Conversation
When the collab server's checkpoint cleanup nulls a document's _data in MongoDB, ShareDB delivers a snapshot with type=null. The load handler in documents-load.ts was missing the guard already present in sharedb.ts and userdata-realtime.ts, causing downstream consumers to crash on null doc.data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…G3EA) assets:getByVirtualPath can return undefined for import paths that don't resolve to a loaded asset. Filter these out before passing to loadDocument() which expects a valid Observer with .get(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…S-G3CG) Replace the two-pass check-then-map pattern with a single-pass loop that bails on the first missing asset. The previous pattern had a window between the some() check and the subsequent map() where an asset could be removed by a concurrent event. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When an asset is deleted, the TreeViewItem is destroyed but remains in the idToItem map briefly. A racing files:select call (from tab close) could set selected on the destroyed item, accessing classList on a null DOM element. Add the same !item.destroyed guard already used in the documents:close handler. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's Changed
Four fixes for Tier 2 Sentry issues in the
browser_liveenvironment, all in the code-editor:doc.on('load')handler indocuments-load.tsagainst nulldoc.type— the collab server's checkpoint cleanup can null document data in MongoDB, causing ShareDB to deliver snapshots withtype=null. The guard pattern already exists insharedb.ts:398anduserdata-realtime.ts:36but was missing here.assets:getByVirtualPathbefore passing toloadDocument()during ESM dependency resolution — unresolved import paths return undefined which crashes on.get('id').monaco/document.ts— eliminates a TOCTOU race where an asset could be removed between thesome()check and the subsequentmap(a => a.get('name')).!item.destroyedguard infiles:selectmethod — matches the pattern already used in thedocuments:closehandler in the same file. PreventsclassListaccess on a destroyed TreeViewItem during asset deletion races.Checks