Skip to content

fix(renderer): prevent empty content from polluting editor cache#429

Open
aculich wants to merge 1 commit intorowboatlabs:mainfrom
aculich:pr/first-load-blank
Open

fix(renderer): prevent empty content from polluting editor cache#429
aculich wants to merge 1 commit intorowboatlabs:mainfrom
aculich:pr/first-load-blank

Conversation

@aculich
Copy link
Copy Markdown
Contributor

@aculich aculich commented Mar 18, 2026

Summary

  • Prevents MarkdownEditor initialization from polluting the editor cache with empty content
  • First file opened after app start now displays correctly instead of appearing blank

Fixes #414

Problem

When the app starts and a markdown file is opened, the file appears blank. Switching to another file and back would show the content correctly. This was caused by the Tiptap editor firing onUpdate('') during initialization, which cached an empty string that was then returned on the cache lookup.

Solution

Two-layer fix:

  1. Primary guard in handleEditorChange: Skip caching when markdown content is empty
  2. Secondary guard in cache lookup: Explicit cachedContent.length > 0 check as defense in depth

Changes

  • apps/x/apps/renderer/src/App.tsx:

    • Added early return in handleEditorChange for empty content
    • Added explicit length check in cache lookup condition
  • apps/x/apps/renderer/src/components/markdown-editor.tsx:

    • Minor refactor (no functional change)

Testing

  1. Start the app fresh (or restart)
  2. Open any markdown file
  3. File should display content immediately (previously was blank)
  4. Opening additional files should continue to work correctly
  5. External file modifications should still be detected correctly

Notes

Issue #414 was previously closed but the problem persisted. This fix addresses the root cause: the editor cache being polluted by empty content during Tiptap initialization.

Made with Cursor

When the MarkdownEditor initializes, it fires onChange('') which was
caching empty content. On first file load, the cache check found this
empty string and returned it instead of loading from disk.

Two-layer fix:
- Primary: Guard in handleEditorChange prevents empty content caching
- Secondary: Explicit length check in cache lookup as defense in depth

Fixes rowboatlabs#414

Made-with: Cursor
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 18, 2026

@aculich is attempting to deploy a commit to the RowBoat Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

Missing files on click

1 participant