#2607·Mailspring

Optimize Spellcheck Performance during Typing

Author: codeCraft-RitikCreated Feb 13, 2026Updated Apr 19, 2026

Summary :

Currently, the ComposerEditor disables spellcheck globally for the editor while the user is typing to avoid performance issues, re-enabling it only after an 800ms debounce. This creates a jarring user experience where red underlines flicker in and out. A better approach is to throttle the spellcheck attribute update or target only the block currently being edited.

File Path : src/components/composer-editor/composer-editor.tsx

Proposed Change :
Increase the debounce threshold or implement a "painless" toggle that doesn't trigger a full React re-render of the editor component, which causes the flickering.

// src/components/composer-editor/composer-editor.tsx

// Change the debounce timing or logic to be less aggressive
this._onDoneTyping = debounce(() => {
  if (this._mounted) {
    // Instead of a full state change, consider a more granular 
    // update if the Slate API allows, to prevent the "swallowed" keys 
    // mentioned in the comments.
    this.setState({ isTyping: false });
  }
}, 1500); // Increase to 1.5s to reduce flicker frequency