@@ -120,6 +120,7 @@ import type {
120120 ReviewAuthor ,
121121 ReviewSource ,
122122} from '../../types.ts' ;
123+ import { useCodeViewPlaceholderFile } from '../hooks/useCodeViewPlaceholderFile.ts' ;
123124import { Avatar } from './Avatar.tsx' ;
124125import { Button } from './Button.tsx' ;
125126import { DefinitionPopover } from './DefinitionPopover.tsx' ;
@@ -2616,6 +2617,7 @@ export function ReviewCodeView({
26162617 wordWrap : boolean ;
26172618} ) {
26182619 const codeViewRef = useRef < CodeViewHandle < ReviewAnnotationMetadata , undefined > > ( null ) ;
2620+ const getPlaceholderFile = useCodeViewPlaceholderFile ( ) ;
26192621 const markdownEditorRefs = useRef ( new Map < string , MarkdownDocumentEditorHandle > ( ) ) ;
26202622 const refreshingMarkdownSectionsRef = useRef ( new Set < string > ( ) ) ;
26212623 const deferredTimersRef = useRef < Set < number > > ( new Set ( ) ) ;
@@ -2812,12 +2814,7 @@ export function ReviewCodeView({
28122814 } satisfies LineAnnotation < ReviewAnnotationMetadata > ,
28132815 ] ,
28142816 collapsed : false ,
2815- file : {
2816- cacheKey : `walkthrough-header:${ block . id } ` ,
2817- contents : ' ' ,
2818- lang : 'text' ,
2819- name : headerId ,
2820- } ,
2817+ file : getPlaceholderFile ( headerId ) ,
28212818 id : headerId ,
28222819 type : 'file' ,
28232820 // Selection stays out of the version: a scroll-driven current-stop
@@ -2974,12 +2971,7 @@ export function ReviewCodeView({
29742971 } satisfies LineAnnotation < ReviewAnnotationMetadata > ,
29752972 ] ,
29762973 collapsed : isCollapsed ,
2977- file : {
2978- cacheKey : `image-preview:${ file . fingerprint } :${ section . id } ` ,
2979- contents : ' ' ,
2980- lang : 'text' ,
2981- name : file . path ,
2982- } ,
2974+ file : getPlaceholderFile ( file . path ) ,
29832975 id,
29842976 type : 'file' ,
29852977 version : getItemVersion (
@@ -3010,14 +3002,7 @@ export function ReviewCodeView({
30103002 } satisfies LineAnnotation < ReviewAnnotationMetadata > ,
30113003 ] ,
30123004 collapsed : isCollapsed ,
3013- file : {
3014- cacheKey : `markdown-preview:${ section . newFile ?. cacheKey ?? file . fingerprint } :${
3015- markdownPreview . contents . length
3016- } :${ markdownPreviewAddedLinesDigest } `,
3017- contents : ' ' ,
3018- lang : 'text' ,
3019- name : file . path ,
3020- } ,
3005+ file : getPlaceholderFile ( file . path ) ,
30213006 id,
30223007 type : 'file' ,
30233008 version : getItemVersion (
@@ -3068,6 +3053,7 @@ export function ReviewCodeView({
30683053 diffStyle ,
30693054 expandedReviewKeys ,
30703055 forceExpandedPaths ,
3056+ getPlaceholderFile ,
30713057 imagePreviewLayoutPassBySection ,
30723058 isReadOnly ,
30733059 itemVersionByKey ,
@@ -3091,17 +3077,15 @@ export function ReviewCodeView({
30913077 return [
30923078 {
30933079 collapsed : true ,
3094- file : {
3095- cacheKey : sourceDescriptionItemId ,
3096- contents : '' ,
3097- lang : 'text' ,
3098- name : shouldShowCommitMessage ? 'commit-message.md' : 'source-description.md' ,
3099- } ,
3080+ file : getPlaceholderFile (
3081+ shouldShowCommitMessage ? 'commit-message.md' : 'source-description.md' ,
3082+ '' ,
3083+ ) ,
31003084 id : sourceDescriptionItemId ,
31013085 type : 'file' ,
31023086 } ,
31033087 ] ;
3104- } , [ items , shouldShowCommitMessage , sourceDescriptionItemId ] ) ;
3088+ } , [ getPlaceholderFile , items , shouldShowCommitMessage , sourceDescriptionItemId ] ) ;
31053089
31063090 const clearCommentLineHighlight = useCallback ( ( ) => {
31073091 codeViewRef . current ?. clearSelectedLines ( ) ;
0 commit comments