diff --git a/src/client/webapp/elements/require/atoms.ts b/src/client/webapp/elements/require/atoms.ts index 99d62d1..6435ee5 100644 --- a/src/client/webapp/elements/require/atoms.ts +++ b/src/client/webapp/elements/require/atoms.ts @@ -441,7 +441,7 @@ export function useRecoilValueSoftImgSrc(recoilValue: RecoilValue): stri } // initialize with a guildsManager -export function initRecoil(guildsManager: GuildsManager) { +export function useInitRecoil(guildsManager: GuildsManager) { const setGuildsManager = useSetRecoilState(guildsManagerState); const setGuilds = useSetRecoilState(allGuildsState); useEffect(() => { @@ -454,6 +454,6 @@ export function initRecoil(guildsManager: GuildsManager) { return () => { guildsManager.off('update-guilds', updateGuilds); }; - }, [ guildsManager ]); + }, [ guildsManager, setGuilds ]); } diff --git a/src/client/webapp/elements/root.tsx b/src/client/webapp/elements/root.tsx index 3fdfecc..f1d1db6 100644 --- a/src/client/webapp/elements/root.tsx +++ b/src/client/webapp/elements/root.tsx @@ -1,7 +1,7 @@ import React, { FC, ReactNode } from 'react'; import { useRecoilValue } from 'recoil'; import GuildsManager from '../guilds-manager'; -import { initRecoil, overlayState } from './require/atoms'; +import { useInitRecoil, overlayState } from './require/atoms'; import GuildsManagerElement from './sections/guilds-manager'; import TitleBar from './sections/title-bar'; @@ -12,7 +12,7 @@ export interface RootElementProps { const RootElement: FC = (props: RootElementProps) => { const { guildsManager } = props; - initRecoil(guildsManager); + useInitRecoil(guildsManager); const overlay = useRecoilValue(overlayState);