MCPcopy
hub / github.com/claude-code-best/claude-code / loadFileHistoryMetadata

Function loadFileHistoryMetadata

src/components/MessageSelector.tsx:343–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341
342 useEffect(() => {
343 async function loadFileHistoryMetadata() {
344 if (!isFileHistoryEnabled) {
345 return;
346 }
347 // Load file snapshot metadata
348 void Promise.all(
349 messageOptions.map(async (userMessage, itemIndex) => {
350 if (userMessage.uuid !== currentUUID) {
351 const canRestore = fileHistoryCanRestore(fileHistory, userMessage.uuid);
352
353 const nextUserMessage = messageOptions.at(itemIndex + 1);
354 const diffStats = canRestore
355 ? computeDiffStatsBetweenMessages(
356 messages,
357 userMessage.uuid,
358 nextUserMessage?.uuid !== currentUUID ? nextUserMessage?.uuid : undefined,
359 )
360 : undefined;
361
362 if (diffStats !== undefined) {
363 setFileHistoryMetadata(prev => ({
364 ...prev,
365 [itemIndex]: diffStats,
366 }));
367 } else {
368 setFileHistoryMetadata(prev => ({
369 ...prev,
370 [itemIndex]: undefined,
371 }));
372 }
373 }
374 }),
375 );
376 }
377 void loadFileHistoryMetadata();
378 }, [messageOptions, messages, currentUUID, fileHistory, isFileHistoryEnabled]);
379

Callers 1

MessageSelectorFunction · 0.85

Calls 2

fileHistoryCanRestoreFunction · 0.85

Tested by

no test coverage detected