File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
backend/src/tools/handlers/tool Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,16 @@ export const handleStrReplace = ((params: {
5252 fileProcessingState . promisesByPath [ path ] = [ ]
5353 }
5454
55- const latestContentPromise = Promise . all (
56- fileProcessingState . promisesByPath [ path ] ,
57- ) . then ( ( results ) => {
58- const previousEdit = results . findLast ( ( r ) => 'content' in r )
59- return previousEdit ? previousEdit . content : requestOptionalFile ( ws , path )
60- } )
55+ const previousPromises = fileProcessingState . promisesByPath [ path ]
56+ const previousEdit = previousPromises [ previousPromises . length - 1 ]
57+
58+ const latestContentPromise = previousEdit
59+ ? previousEdit . then ( ( maybeResult ) =>
60+ maybeResult && 'content' in maybeResult
61+ ? maybeResult . content
62+ : requestOptionalFile ( ws , path ) ,
63+ )
64+ : requestOptionalFile ( ws , path )
6165
6266 const newPromise = processStrReplace ( path , replacements , latestContentPromise )
6367 . catch ( ( error : any ) => {
You can’t perform that action at this time.
0 commit comments