Rewrite websocket to use tracked state instead of context (#10091)

* Rewrite websocket to use tracked state instead of context

* Cleanup

* Use component for updating items

* Fix scroll update

* Don't save vite
This commit is contained in:
Nicolas Mowen
2024-02-27 09:05:28 -07:00
committed by GitHub
parent f95ce913b1
commit 21defbea9d
8 changed files with 210 additions and 216 deletions

View File

@@ -1,9 +1,8 @@
import { baseUrl } from "./baseUrl";
import useSWR, { SWRConfig } from "swr";
import { SWRConfig } from "swr";
import { WsProvider } from "./ws";
import axios from "axios";
import { ReactNode } from "react";
import { FrigateConfig } from "@/types/frigateConfig";
axios.defaults.baseURL = `${baseUrl}api/`;
@@ -38,9 +37,7 @@ type WsWithConfigType = {
};
function WsWithConfig({ children }: WsWithConfigType) {
const { data } = useSWR<FrigateConfig>("config");
return data ? <WsProvider config={data}>{children}</WsProvider> : children;
return <WsProvider>{children}</WsProvider>;
}
export function useApiHost() {