Changes to troubleshoot #2291

This commit is contained in:
Gabe Kangas
2022-11-02 00:01:21 -07:00
parent add6a959c7
commit 50f23a0807

View File

@ -149,7 +149,7 @@ export const visibleChatMessagesSelector = selector<ChatMessage[]>({
});
export const ClientConfigStore: FC = () => {
const [appState, appStateSend, appStateService] = useMachine(appStateModel);
const [, appStateSend, appStateService] = useMachine(appStateModel);
const [currentUser, setCurrentUser] = useRecoilState(currentUserAtom);
const setChatAuthenticated = useSetRecoilState<boolean>(chatAuthenticatedAtom);
const [clientConfig, setClientConfig] = useRecoilState<ClientConfig>(clientConfigStateAtom);
@ -178,6 +178,10 @@ export const ClientConfigStore: FC = () => {
};
const updateClientConfig = async () => {
if (hasLoadedConfig) {
return;
}
try {
const config = await ClientConfigService.getConfig();
setClientConfig(config);
@ -193,6 +197,10 @@ export const ClientConfigStore: FC = () => {
};
const updateServerStatus = async () => {
if (hasLoadedStatus) {
return;
}
try {
const status = await ServerStatusService.getStatus();
setServerStatus(status);
@ -216,7 +224,6 @@ export const ClientConfigStore: FC = () => {
);
console.error(`serverStatusState -> getStatus() ERROR: \n${error}`);
}
return null;
};
const handleUserRegistration = async (optionalDisplayName?: string) => {
@ -377,7 +384,11 @@ export const ClientConfigStore: FC = () => {
serverStatusRefreshPoll = setInterval(() => {
updateServerStatus();
}, SERVER_STATUS_POLL_DURATION);
}, [appState]);
return () => {
clearInterval(serverStatusRefreshPoll);
};
}, []);
useEffect(() => {
if (!accessToken) {
@ -400,7 +411,7 @@ export const ClientConfigStore: FC = () => {
setAppState(metadata);
});
});
}, []);
return null;
};