File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 11import { useEffect } from "react" ;
2+
3+ import { useListener } from "../contexts/listener" ;
24import * as main from "../store/tinybase/main" ;
35import { CONFIG_REGISTRY , type ConfigKey } from "./registry" ;
46
@@ -40,6 +42,7 @@ export function useConfigValues<K extends ConfigKey>(keys: readonly K[]): { [P i
4042}
4143
4244export function useConfigSideEffects ( keys ?: ConfigKey [ ] ) {
45+ const active = useListener ( ( state ) => state . status === "running_active" ) ;
4346 const configsToWatch = keys ?? ( Object . keys ( CONFIG_REGISTRY ) as ConfigKey [ ] ) ;
4447
4548 const allValues = main . UI . useValues ( main . STORE_ID ) ;
@@ -59,12 +62,17 @@ export function useConfigSideEffects(keys?: ConfigKey[]) {
5962 } ;
6063
6164 useEffect ( ( ) => {
65+ // TODO: hack to avoid restarting server while in meeting.
66+ if ( active ) {
67+ return ;
68+ }
69+
6270 for ( const key of configsToWatch ) {
6371 const definition = CONFIG_REGISTRY [ key ] ;
6472 if ( definition && "sideEffect" in definition && definition . sideEffect ) {
6573 const value = getConfig ( key ) ;
6674 ( definition . sideEffect as any ) ( value , getConfig ) ;
6775 }
6876 }
69- } , [ allValues ] ) ;
77+ } , [ allValues , active ] ) ;
7078}
Original file line number Diff line number Diff line change @@ -13,11 +13,16 @@ export const Route = createFileRoute("/app")({
1313function Component ( ) {
1414 const { listenerStore } = Route . useLoaderData ( ) ;
1515
16- useConfigSideEffects ( ) ;
17-
1816 return (
1917 < ListenerProvider store = { listenerStore } >
2018 < Outlet />
19+ < SideEffects />
2120 </ ListenerProvider >
2221 ) ;
2322}
23+
24+ function SideEffects ( ) {
25+ useConfigSideEffects ( ) ;
26+
27+ return null ;
28+ }
You can’t perform that action at this time.
0 commit comments