Fix composer cut crash + suppress third-party plugin Sentry noise#2755
Merged
Conversation
…gins MAILSPRING-CLIENT-42: onCut was passing the real `next` callback to onCopy, which called next() internally. Then onCut called next() again, invoking slate-react's cloneFragment twice. On the second invocation the DOM selection was already modified, causing "Cannot read properties of undefined (reading 'firstChild')". Fixed by passing a no-op to onCopy and calling next() exactly once in onCut. MAILSPRING-CLIENT-3: User-installed third-party plugins (e.g. mailspring-avatars) fail to activate when they rely on deprecated or changed APIs. These failures are not actionable for Mailspring maintainers. Changed package-manager to only report activation errors to Sentry for built-in (internal_packages) plugins; user-installed plugin errors are now only logged to the console. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgZZbFxdx38Ngc9vpanNow
Contributor
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.
Summary
Fixes two Sentry issues found in the 1.22.0 release:
MAILSPRING-CLIENT-42 — Composer cut crashes with "Cannot read properties of undefined (reading 'firstChild')" (17 users, 41 events)
Root cause:
onCutpassed the realnextcallback toonCopy, which callednext()once internally. ThenonCutcallednext()a second time. This double-invocation caused slate-react'scloneFragmentto run twice: the first time worked fine, but on the second invocation the DOM selection had already been modified by the cut, sofirstChildwasundefined.Fix: Pass a no-op callback to
onCopyfromonCut, then callnext()exactly once inonCut.onCopystill sets thetext/htmlandtext/plainclipboard data; the singlenext()call lets Slate attach its fragment and perform the text deletion.MAILSPRING-CLIENT-3 — "Failed to activate plugin mailspring-avatars" (35 users, 475 events)
Root cause:
mailspring-avatarsis a user-installed third-party plugin (not ininternal_packages). It fails withCannot read properties of undefined (reading 'string')during activation — likely because it relies on a deprecated API (e.g.React.PropTypes.string). We have no control over this plugin's code.Fix: In
package-manager.ts, only report activation failures to Sentry for built-in packages (those whose directory is underresourcePath). For user-installed plugins, the error is still logged to the console but no longer sent to Sentry, where it is not actionable.Test plan
Sentry links
🤖 Generated with Claude Code
https://claude.ai/code/session_01HgZZbFxdx38Ngc9vpanNow
Generated by Claude Code