mirror of
https://github.com/owncast/owncast.git
synced 2025-11-01 10:55:57 +08:00
Changes to troubleshoot #2291
This commit is contained in:
@ -149,7 +149,7 @@ export const visibleChatMessagesSelector = selector<ChatMessage[]>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const ClientConfigStore: FC = () => {
|
export const ClientConfigStore: FC = () => {
|
||||||
const [appState, appStateSend, appStateService] = useMachine(appStateModel);
|
const [, appStateSend, appStateService] = useMachine(appStateModel);
|
||||||
const [currentUser, setCurrentUser] = useRecoilState(currentUserAtom);
|
const [currentUser, setCurrentUser] = useRecoilState(currentUserAtom);
|
||||||
const setChatAuthenticated = useSetRecoilState<boolean>(chatAuthenticatedAtom);
|
const setChatAuthenticated = useSetRecoilState<boolean>(chatAuthenticatedAtom);
|
||||||
const [clientConfig, setClientConfig] = useRecoilState<ClientConfig>(clientConfigStateAtom);
|
const [clientConfig, setClientConfig] = useRecoilState<ClientConfig>(clientConfigStateAtom);
|
||||||
@ -178,6 +178,10 @@ export const ClientConfigStore: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateClientConfig = async () => {
|
const updateClientConfig = async () => {
|
||||||
|
if (hasLoadedConfig) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const config = await ClientConfigService.getConfig();
|
const config = await ClientConfigService.getConfig();
|
||||||
setClientConfig(config);
|
setClientConfig(config);
|
||||||
@ -193,6 +197,10 @@ export const ClientConfigStore: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateServerStatus = async () => {
|
const updateServerStatus = async () => {
|
||||||
|
if (hasLoadedStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const status = await ServerStatusService.getStatus();
|
const status = await ServerStatusService.getStatus();
|
||||||
setServerStatus(status);
|
setServerStatus(status);
|
||||||
@ -216,7 +224,6 @@ export const ClientConfigStore: FC = () => {
|
|||||||
);
|
);
|
||||||
console.error(`serverStatusState -> getStatus() ERROR: \n${error}`);
|
console.error(`serverStatusState -> getStatus() ERROR: \n${error}`);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUserRegistration = async (optionalDisplayName?: string) => {
|
const handleUserRegistration = async (optionalDisplayName?: string) => {
|
||||||
@ -377,7 +384,11 @@ export const ClientConfigStore: FC = () => {
|
|||||||
serverStatusRefreshPoll = setInterval(() => {
|
serverStatusRefreshPoll = setInterval(() => {
|
||||||
updateServerStatus();
|
updateServerStatus();
|
||||||
}, SERVER_STATUS_POLL_DURATION);
|
}, SERVER_STATUS_POLL_DURATION);
|
||||||
}, [appState]);
|
|
||||||
|
return () => {
|
||||||
|
clearInterval(serverStatusRefreshPoll);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!accessToken) {
|
if (!accessToken) {
|
||||||
@ -400,7 +411,7 @@ export const ClientConfigStore: FC = () => {
|
|||||||
|
|
||||||
setAppState(metadata);
|
setAppState(metadata);
|
||||||
});
|
});
|
||||||
});
|
}, []);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user