docs(editor): state the fault-tracking constraints in present tense

This commit is contained in:
Frederic Barthelemy
2026-09-18 04:32:03 -07:00
committed by Neil
parent 68c9a1b248
commit 9d2ca03c4c
3 changed files with 10 additions and 12 deletions
@@ -127,9 +127,8 @@ export function getEditorPanelRenderModel({
!inlineFileContent.loadError &&
activeFile.conflict?.kind !== 'conflict-placeholder' &&
activeFile.conflict?.conflictStatus !== 'unresolved'
// Why: classifying scans the whole document, so it only runs while the user
// is looking at Rich mode. Source-view tabs read the stored fault instead
// (see useMarkdownRichModeFaultTracking) rather than re-scanning.
// Why: classification scans the whole document, so it runs only in Rich
// mode; Source-view tabs read the stored fault (useMarkdownRichModeFaultTracking).
const richModeEligibility =
canRenderInlineMarkdown && mdViewMode === 'rich'
? getCachedMarkdownRichModeEligibility({
@@ -10,10 +10,9 @@ type UseMarkdownRichModeFaultTrackingParams = {
setMarkdownRichModeFaultedContent: (fileId: string, content: string | null) => void
}
// Why: getMarkdownRenderMode only decides source-vs-rich-vs-preview for the
// content it's given; recording that a Rich attempt fell back (or recovered)
// as durable per-tab state is a side effect, so it belongs in an effect keyed
// off the render model's output rather than during render itself.
// Why: recording that a Rich attempt fell back or recovered is durable per-tab
// state, a side effect, so it lives in an effect keyed off the render model's
// output, never inside render.
export function useMarkdownRichModeFaultTracking({
fileId,
mdViewMode,
@@ -29,8 +28,8 @@ export function useMarkdownRichModeFaultTracking({
setMarkdownRichModeFaultedContent(fileId, inlineMarkdownContent)
return
}
// Why: a successful Rich attempt for this content means it's no longer a
// fault, whatever content is currently stored for this tab.
// Why: a successful Rich attempt for this content clears the fault,
// whatever content is currently stored for this tab.
setMarkdownRichModeFaultedContent(fileId, null)
}, [
fileId,
@@ -17,9 +17,9 @@ export type EditorDraftState = {
// Why: per-file opt-in to open an oversized markdown file in the rich editor despite the size limit.
markdownRichModeSizeOverride: Record<string, boolean>
setMarkdownRichModeSizeOverride: (fileId: string, enabled: boolean) => void
// Why: the content string that made rich mode fall back to Source for this
// tab, so the toggle can offer Preview without re-scanning. A stale entry
// (content no longer matches) reads as "not faulted for this content".
// Why: the content that made rich mode fall back to Source for this tab, so
// the toggle can offer Preview without re-scanning; a stale entry (content
// differs) reads as not faulted.
markdownRichModeFaultedContent: Record<string, string>
setMarkdownRichModeFaultedContent: (fileId: string, content: string | null) => void
editorViewMode: Record<string, EditorViewMode>