@@ -5,12 +5,8 @@ import { Outlet } from "react-router";
55import { ReactRouterAppProvider } from "@toolpad/core/react-router" ;
66import type { Navigation } from "@toolpad/core/AppProvider" ;
77import { NotificationsProvider } from "@toolpad/core/useNotifications" ;
8- import { useEffect , useReducer , useState } from "react" ;
9- import { runMethod } from "./socket" ;
10- import { deserialize } from "./utils/deserializer" ;
11- import { SerializedObject } from "./types/SerializedObject" ;
8+ import { useReducer } from "react" ;
129import { ExperimentsContext } from "./contexts/ExperimentsContext" ;
13- import { ExperimentDict } from "./types/ExperimentMetadata" ;
1410import { SvgIcon } from "@mui/material" ;
1511import SettingsIcon from "@mui/icons-material/Settings" ;
1612import { ParameterDisplayGroupsContext } from "./contexts/ParameterDisplayGroupsContext" ;
@@ -23,6 +19,7 @@ import { DeviceStateContext, deviceStateReducer } from "./contexts/DeviceStateCo
2319import logo from "./assets/logo.png" ;
2420import { useParameterStore } from "./hooks/useParameterStore" ;
2521import { useParameterDisplayGroups } from "./hooks/useParameterDisplayGroups" ;
22+ import { useExperiments } from "./hooks/useExperiments" ;
2623
2724const NAVIGATION : Navigation = [
2825 {
@@ -76,21 +73,16 @@ export const BRANDING = {
7673} ;
7774
7875export default function App ( ) {
79- const [ experiments , setExperiments ] = useState < ExperimentDict > ( { } ) ;
8076 const [ scheduledJobs , schedulerDispatch ] = useReducer ( reducer , { } ) ;
8177 const [ deviceInfo , deviceInfoDispatch ] = useReducer ( deviceInfoReducer , { } ) ;
8278 const [ deviceStates , deviceStateDispatch ] = useReducer ( deviceStateReducer , null ) ;
8379 const parameterStore = useParameterStore ( ) ;
8480 const { parameterDisplayGroups, parameterNamespaceToDisplayGroups } =
8581 useParameterDisplayGroups ( ) ;
82+ const experiments = useExperiments ( ) ;
8683
8784 useJobsSync ( schedulerDispatch ) ;
8885 useDevicesSync ( deviceStateDispatch , deviceInfoDispatch ) ;
89- useEffect ( ( ) => {
90- runMethod ( "experiments.get_experiments" , [ ] , { } , ( ack ) => {
91- setExperiments ( deserialize ( ack as SerializedObject ) as ExperimentDict ) ;
92- } ) ;
93- } , [ ] ) ;
9486
9587 return (
9688 < ReactRouterAppProvider navigation = { NAVIGATION } branding = { BRANDING } >
0 commit comments