mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
The app held every flow in memory and redid all of its work for each new one: the sidebar mounted every domain and path node (its tree scrolled inside a container that never bounded it), every tree row looked up its atoms by scanning every atom the family had made, and the layout, detail pane and list rows re-rendered per flow. At 3,000 flows each new one cost about 90 ms of main thread, more than the traffic left time for. The app now holds a window of the newest 2,000 flows, applies new ones in batches, and loads older ones in pages from the database on scrolling to the top, through a new list_flows RPC that pages in SQL. The database keeps every flow. Also adds clear_flows: an RPC, POST /flows/clear on the control API, and a Clear button in the header that Cmd+K opens, confirming first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { createStore, Provider } from "jotai";
|
|
import { LazyMotion, MotionConfig } from "motion/react";
|
|
import { HotkeyProvider } from "@yaakapp-internal/ui";
|
|
import { type ReactNode, StrictMode } from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import { ProxyLayout } from "./components/ProxyLayout";
|
|
import { useHotkeyContextValue } from "./lib/hotkeys";
|
|
import { syncFlows } from "./lib/store";
|
|
import "./main.css";
|
|
|
|
const queryClient = new QueryClient();
|
|
const jotaiStore = createStore();
|
|
|
|
syncFlows(jotaiStore);
|
|
|
|
function Hotkeys({ children }: { children: ReactNode }) {
|
|
return <HotkeyProvider value={useHotkeyContextValue()}>{children}</HotkeyProvider>;
|
|
}
|
|
|
|
const motionFeatures = () => import("framer-motion").then((mod) => mod.domAnimation);
|
|
|
|
createRoot(document.getElementById("root") as HTMLElement).render(
|
|
<StrictMode>
|
|
<QueryClientProvider client={queryClient}>
|
|
<Provider store={jotaiStore}>
|
|
<Hotkeys>
|
|
<LazyMotion strict features={motionFeatures}>
|
|
<MotionConfig transition={{ duration: 0.1 }}>
|
|
<ProxyLayout />
|
|
</MotionConfig>
|
|
</LazyMotion>
|
|
</Hotkeys>
|
|
</Provider>
|
|
</QueryClientProvider>
|
|
</StrictMode>,
|
|
);
|