fix(ui): keep diff refreshes targeted
This commit is contained in:
@@ -74,6 +74,7 @@ import { openDesktopFileInApp, openDesktopPath } from '@/lib/desktop';
|
||||
import { useOpenInAppsStore } from '@/stores/useOpenInAppsStore';
|
||||
import { eventMatchesShortcut, getEffectiveShortcutCombo } from '@/lib/shortcuts';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { sessionEvents } from '@/lib/sessionEvents';
|
||||
|
||||
type FileNode = {
|
||||
name: string;
|
||||
@@ -1655,6 +1656,12 @@ export const FilesView: React.FC<FilesViewProps> = ({ mode = 'full' }) => {
|
||||
return false;
|
||||
}
|
||||
setFileContent(draftContent);
|
||||
if (root && isPathWithinRoot(selectedFile.path, root)) {
|
||||
const relativePath = getDisplayPath(root, selectedFile.path);
|
||||
if (relativePath) {
|
||||
sessionEvents.requestGitRefresh({ directory: root, paths: [relativePath] });
|
||||
}
|
||||
}
|
||||
if (selectedFile?.path && isDrawioFile(selectedFile.path)) {
|
||||
diagramXmlRef.current = draftContent;
|
||||
diagramSavedXmlRef.current = draftContent;
|
||||
@@ -1674,7 +1681,7 @@ export const FilesView: React.FC<FilesViewProps> = ({ mode = 'full' }) => {
|
||||
} finally {
|
||||
setIsSaving(false);
|
||||
}
|
||||
}, [contentDetectedBinary, draftContent, fileContent, fileLoading, files, isDirty, loadedFileLineEnding, loadedFilePath, readFileStat, selectedFile, t]);
|
||||
}, [contentDetectedBinary, draftContent, fileContent, fileLoading, files, isDirty, loadedFileLineEnding, loadedFilePath, readFileStat, root, selectedFile, t]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isDirty) {
|
||||
|
||||
Reference in New Issue
Block a user