Skip to content

Conversation

@farseenmanekhan1232
Copy link

Problem

Users were experiencing frame drops and delays on every keystroke.

Root Cause

The app was performing synchronous disk writes on every single character typed. Each keystroke triggered:

  1. File write to disk (blocking main thread)
  2. File read to update preview (more blocking I/O)
  3. State mutation causing view re-render

Changes

  • Debounce text saves (500ms delay) instead of saving on every keystroke
  • Move file I/O to background queue to avoid blocking main thread
  • Add updatePreviewTextFromContent to avoid re-reading saved file
  • Add willResignActiveNotification handler to save when app loses focus
  • Remove unused saveTimer that was creating unnecessary overhead

Testing

Tested locally - no more frame drops during rapid typing. Text is still reliably saved after 500ms of inactivity or when switching apps.

- Debounce text saves (500ms delay) instead of saving on every keystroke
- Move file I/O to background queue to avoid blocking main thread
- Add updatePreviewTextFromContent to avoid re-reading saved file
- Add willResignActiveNotification handler to save when app loses focus
- Remove unused saveTimer that was creating unnecessary overhead

Fixes frame drops and delays reported by users during typing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant