Start extracting Tree component

This commit is contained in:
Gregory Schier
2026-03-08 16:37:25 -07:00
parent 6e11894f79
commit 6534421733
19 changed files with 344 additions and 151 deletions

View File

@@ -7,11 +7,18 @@ import { StrictMode, useState } from "react";
import { createRoot } from "react-dom/client";
import "./main.css";
import { listen, rpc } from "./rpc";
import { applyChange, dataAtom, httpExchangesAtom } from "./store";
import { applyChange, dataAtom, httpExchangesAtom, replaceAll } from "./store";
const queryClient = new QueryClient();
const jotaiStore = createStore();
// Load initial models from the database
rpc("list_models", {}).then((res) => {
jotaiStore.set(dataAtom, (prev) =>
replaceAll(prev, "http_exchange", res.httpExchanges),
);
});
// Subscribe to model change events from the backend
listen("model_write", (payload) => {
jotaiStore.set(dataAtom, (prev) =>

View File

@@ -5,7 +5,7 @@ type ProxyModels = {
http_exchange: HttpExchange;
};
export const { dataAtom, applyChange, listAtom, orderedListAtom } =
export const { dataAtom, applyChange, replaceAll, listAtom, orderedListAtom } =
createModelStore<ProxyModels>(["http_exchange"]);
export const httpExchangesAtom = orderedListAtom(