Skip to content

Optimize Spellcheck Performance during Typing #2607

@codeCraft-Ritik

Description

@codeCraft-Ritik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions