Skip to content

refactor: debounced preview render goes through renderTabPreviewFromRaw#218

Open
PathGao wants to merge 1 commit into
alecdotdev:masterfrom
PathGao:refactor/debounce-render-single-path
Open

refactor: debounced preview render goes through renderTabPreviewFromRaw#218
PathGao wants to merge 1 commit into
alecdotdev:masterfrom
PathGao:refactor/debounce-render-single-path

Conversation

@PathGao

@PathGao PathGao commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What

Replaces the hand-written render/write-back/marker/refresh sequence in the editor debounce path with a call to renderTabPreviewFromRaw, which already encapsulates exactly those steps (added in #194). Net: −7/+1 lines, no behavior change.

Why

The debounce block was a byte-for-byte duplicate of the helper's body. Duplicated recipes drift: when the preview pipeline changes (as it did in #194, when front-matter stripping moved into renderMarkdownPreview), every hand-copy is a spot the refactor can miss. Keeping a single shared path means future pipeline changes reach every render site at once.

The other direct renderMarkdownPreview call sites (initial load, chunked full-content load, untitled-tab toggle, startup restore) were left as-is — each differs from the helper on purpose (conditional rich-content refresh, loading-state handling, empty path for untitled buffers).

Verification

  • npm run check: 0 errors, 0 warnings
  • node --test over all script tests: 56/56 pass

🤖 Generated with Claude Code

The debounce path hand-copied the render/write-back/marker/refresh
sequence that renderTabPreviewFromRaw already encapsulates. One shared
path means future pipeline changes reach every render site at once.
No behavior change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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