fix(renderer): prevent empty content from polluting editor cache#429
Open
aculich wants to merge 1 commit intorowboatlabs:mainfrom
Open
fix(renderer): prevent empty content from polluting editor cache#429aculich wants to merge 1 commit intorowboatlabs:mainfrom
aculich wants to merge 1 commit intorowboatlabs:mainfrom
Conversation
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
|
@aculich is attempting to deploy a commit to the RowBoat Labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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:
handleEditorChange: Skip caching when markdown content is emptycachedContent.length > 0check as defense in depthChanges
apps/x/apps/renderer/src/App.tsx:handleEditorChangefor empty contentapps/x/apps/renderer/src/components/markdown-editor.tsx:Testing
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