Skip to content

Add comment explaining eslint-disable for react-hooks/exhaustive-deps in FileEditorPane #65

@khang859

Description

@khang859

Context

PR #61 adds FileEditorPane.tsx with a CodeMirror 6 editor.

Issue

The editor creation useEffect has an eslint-disable-next-line react-hooks/exhaustive-deps suppression (line ~566) because filePath and setPaneDirty are intentionally omitted from the dependency array — the editor should not be recreated when those change.

This is correct behavior, but there's no comment explaining why these deps are excluded. Future developers may mistakenly "fix" this by adding them back, causing the editor to remount on every dirty state change.

Suggested fix

Add a brief comment above the disable:

// filePath and setPaneDirty intentionally omitted — editor instance must persist
// across dirty state changes. Recreating would lose cursor position and undo history.
// eslint-disable-next-line react-hooks/exhaustive-deps

From PR #61 review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions