refactor: remove old git-diff and file-explorer screens

- Delete standalone /git-diff and /file-explorer routes
- Update agent menu to open explorer sidebar instead of navigating
- Update file path clicks in chat to open sidebar
- Fix unnecessary re-renders in sidebar panes by using agents.has() instead of agents.get()

🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
Mohamed Boudra
2026-01-09 11:05:20 +07:00
parent 3ba778eea7
commit 6f278cb6a6
8 changed files with 21 additions and 2251 deletions
@@ -17,7 +17,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { StyleSheet, useUnistyles } from "react-native-unistyles";
import Animated, { FadeIn, FadeOut, cancelAnimation, useAnimatedStyle, useSharedValue, withDelay, withRepeat, withSequence, withTiming } from "react-native-reanimated";
import { ChevronDown } from "lucide-react-native";
import { useRouter } from "expo-router";
import { useExplorerSidebarStore } from "@/stores/explorer-sidebar-store";
import {
AssistantMessage,
UserMessage,
@@ -72,7 +72,7 @@ export function AgentStreamView({
const isProgrammaticScrollRef = useRef(false);
const isNearBottomRef = useRef(true);
const isUserScrollingRef = useRef(false);
const router = useRouter();
const { open: openExplorer, setActiveTab: setExplorerTab } = useExplorerSidebarStore();
// Get serverId (fallback to agent's serverId if not provided)
const resolvedServerId = serverId ?? agent.serverId ?? "";
@@ -134,29 +134,16 @@ export function AgentStreamView({
requestFilePreviewOrInert(agentId, normalized.file);
}
router.push({
pathname: "/file-explorer",
params: {
agentId,
path: normalized.directory,
serverId: resolvedServerId,
...(normalized.file ? { file: normalized.file } : {}),
...(target.lineStart !== undefined
? { lineStart: String(target.lineStart) }
: {}),
...(target.lineEnd !== undefined
? { lineEnd: String(target.lineEnd) }
: {}),
},
});
setExplorerTab("files");
openExplorer();
},
[
agent.cwd,
agentId,
requestDirectoryListingOrInert,
requestFilePreviewOrInert,
resolvedServerId,
router,
setExplorerTab,
openExplorer,
]
);
@@ -70,10 +70,10 @@ export function FileExplorerPane({
const { connectionStates } = useDaemonConnections();
const daemonProfile = connectionStates.get(serverId)?.daemon;
const agent = useSessionStore((state) =>
const agentExists = useSessionStore((state) =>
agentId && state.sessions[serverId]
? state.sessions[serverId]?.agents.get(agentId)
: undefined
? state.sessions[serverId]?.agents.has(agentId)
: false
);
const explorerState = useSessionStore((state) =>
@@ -763,7 +763,7 @@ export function FileExplorerPane({
setThumbnailLoadingMap({});
}, [activePath, viewMode]);
if (!agent) {
if (!agentExists) {
return (
<View style={styles.centerState}>
<Text style={styles.errorText}>Agent not found</Text>
@@ -218,11 +218,11 @@ export function GitDiffPane({ serverId, agentId }: GitDiffPaneProps) {
agentId,
});
const agent = useSessionStore((state) =>
state.sessions[serverId]?.agents?.get(agentId)
const agentExists = useSessionStore((state) =>
state.sessions[serverId]?.agents?.has(agentId) ?? false
);
if (!agent) {
if (!agentExists) {
return (
<View style={styles.errorContainer}>
<Text style={styles.errorText}>Agent not found</Text>