fix: handle multi-file tool diffs safely
Split multi-file patches before diff rendering Fixed hook dependency lint warnings
This commit is contained in:
@@ -785,7 +785,7 @@ export const GitView: React.FC = () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
[currentDirectory, git, fetchStatus, fetchBranches]
|
||||
[currentDirectory, git, fetchStatus, fetchBranches, t]
|
||||
);
|
||||
|
||||
const refreshLog = React.useCallback(async () => {
|
||||
@@ -972,7 +972,7 @@ export const GitView: React.FC = () => {
|
||||
} finally {
|
||||
setRemovingRemoteName(null);
|
||||
}
|
||||
}, [currentDirectory, git, refreshRemotes, refreshStatusAndBranches]);
|
||||
}, [currentDirectory, git, refreshRemotes, refreshStatusAndBranches, t]);
|
||||
|
||||
const handleCommit = async (options: { pushAfter?: boolean } = {}) => {
|
||||
if (!currentDirectory) return;
|
||||
@@ -1066,7 +1066,7 @@ export const GitView: React.FC = () => {
|
||||
} finally {
|
||||
setIsGeneratingMessage(false);
|
||||
}
|
||||
}, [currentDirectory, selectedPaths, settingsGitmojiEnabled, gitmojiEmojis, scrollActionPanelToBottom]);
|
||||
}, [currentDirectory, selectedPaths, settingsGitmojiEnabled, gitmojiEmojis, scrollActionPanelToBottom, t]);
|
||||
|
||||
const formatBlockingReason = (reason: ReturnType<typeof getMutationBlockingReasons>[number]): string => {
|
||||
if (reason.reason === 'attention') {
|
||||
@@ -1517,7 +1517,7 @@ export const GitView: React.FC = () => {
|
||||
});
|
||||
}
|
||||
},
|
||||
[currentDirectory, refreshStatusAndBranches, git]
|
||||
[currentDirectory, refreshStatusAndBranches, git, t]
|
||||
);
|
||||
|
||||
const handleRevertAll = React.useCallback(
|
||||
@@ -1575,7 +1575,7 @@ export const GitView: React.FC = () => {
|
||||
setIsRevertingAll(false);
|
||||
}
|
||||
},
|
||||
[currentDirectory, git, isRevertingAll, refreshStatusAndBranches]
|
||||
[currentDirectory, git, isRevertingAll, refreshStatusAndBranches, t]
|
||||
);
|
||||
|
||||
const handleInsertHighlights = React.useCallback((sourceHighlights: string[]) => {
|
||||
@@ -1787,7 +1787,7 @@ export const GitView: React.FC = () => {
|
||||
const message = err instanceof Error ? err.message : `Failed to abort ${conflictOperation}`;
|
||||
toast.error(message);
|
||||
}
|
||||
}, [currentDirectory, git, conflictOperation, refreshStatusAndBranches, refreshLog, clearConflictState]);
|
||||
}, [currentDirectory, git, conflictOperation, refreshStatusAndBranches, refreshLog, clearConflictState, t]);
|
||||
|
||||
// Check if there are unresolved conflicts (files with 'U' status)
|
||||
const hasUnresolvedConflicts = React.useMemo(() => {
|
||||
@@ -1839,7 +1839,7 @@ export const GitView: React.FC = () => {
|
||||
const message = err instanceof Error ? err.message : t('gitView.toast.continueOperationFailed');
|
||||
toast.error(message);
|
||||
}
|
||||
}, [currentDirectory, git, status, refreshStatusAndBranches, refreshLog, persistConflictState, clearConflictState]);
|
||||
}, [currentDirectory, git, status, refreshStatusAndBranches, refreshLog, persistConflictState, clearConflictState, t]);
|
||||
|
||||
const handleAbortOperation = React.useCallback(async () => {
|
||||
if (!currentDirectory) return;
|
||||
@@ -1860,7 +1860,7 @@ export const GitView: React.FC = () => {
|
||||
const message = err instanceof Error ? err.message : t('gitView.toast.abortOperationFailed');
|
||||
toast.error(message);
|
||||
}
|
||||
}, [currentDirectory, git, status, refreshStatusAndBranches, refreshLog, clearConflictState]);
|
||||
}, [currentDirectory, git, status, refreshStatusAndBranches, refreshLog, clearConflictState, t]);
|
||||
|
||||
const handleResolveWithAIFromBanner = React.useCallback(() => {
|
||||
if (!currentDirectory) return;
|
||||
@@ -1958,7 +1958,7 @@ export const GitView: React.FC = () => {
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
[currentDirectory, git, status, stashDialogOperation, stashDialogBranch, refreshStatusAndBranches, refreshLog]
|
||||
[currentDirectory, git, status, stashDialogOperation, stashDialogBranch, refreshStatusAndBranches, refreshLog, t]
|
||||
);
|
||||
|
||||
if (!currentDirectory) {
|
||||
|
||||
Reference in New Issue
Block a user