mirror of
https://github.com/getpaseo/paseo.git
synced 2026-08-15 04:42:45 +00:00
- Add useGitDiffQuery hook using React Query for caching and revalidation - Add sendRpcRequest utility for promisified WebSocket RPC with requestId matching - Add requestId to git_diff_request/response for proper request correlation - Enable pull-to-refresh via RefreshControl in GitDiffPane - Auto-revalidate when sidebar opens with "changes" tab active - Clean up diff display: remove metadata noise, strip +/- prefixes - Default both sidebars open on web platform 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
34 lines
854 B
TypeScript
34 lines
854 B
TypeScript
import { create } from "zustand";
|
|
import { persist, createJSONStorage } from "zustand/middleware";
|
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
import { Platform } from "react-native";
|
|
|
|
interface SidebarState {
|
|
isOpen: boolean;
|
|
toggle: () => void;
|
|
open: () => void;
|
|
close: () => void;
|
|
}
|
|
|
|
const DEFAULT_OPEN = Platform.OS === "web";
|
|
|
|
export const useSidebarStore = create<SidebarState>()(
|
|
persist(
|
|
(set) => ({
|
|
isOpen: DEFAULT_OPEN,
|
|
toggle: () => set((state) => ({ isOpen: !state.isOpen })),
|
|
open: () => set({ isOpen: true }),
|
|
close: () => set({ isOpen: false }),
|
|
}),
|
|
{
|
|
name: "sidebar-state",
|
|
storage: createJSONStorage(() => AsyncStorage),
|
|
partialize: (state) => ({ isOpen: state.isOpen }),
|
|
}
|
|
)
|
|
);
|
|
|
|
export function useSidebar() {
|
|
return useSidebarStore();
|
|
}
|