From 32d085085455ef7a5ab9cec8d598507047aa50d9 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 13 Nov 2022 19:27:24 -0800 Subject: [PATCH] Fix another first-launch bug --- web/components/stores/ClientConfigStore.tsx | 6 ------ web/components/stores/application-state.ts | 16 +++++++--------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/web/components/stores/ClientConfigStore.tsx b/web/components/stores/ClientConfigStore.tsx index 1b3ee7927..b8ee692ea 100644 --- a/web/components/stores/ClientConfigStore.tsx +++ b/web/components/stores/ClientConfigStore.tsx @@ -238,13 +238,11 @@ export const ClientConfigStore: FC = () => { try { sendEvent(AppStateEvent.NeedsRegister); const response = await ChatService.registerUser(optionalDisplayName); - console.log(`ChatService -> registerUser() response: \n${response}`); const { accessToken: newAccessToken, displayName: newDisplayName, displayColor } = response; if (!newAccessToken) { return; } - console.log('setting access token', newAccessToken); setCurrentUser({ ...currentUser, displayName: newDisplayName, @@ -399,10 +397,6 @@ export const ClientConfigStore: FC = () => { useEffect(() => { appStateService.onTransition(state => { - if (!state.changed) { - return; - } - const metadata = mergeMeta(state.meta) as AppStateOptions; // console.debug('--- APP STATE: ', state.value); diff --git a/web/components/stores/application-state.ts b/web/components/stores/application-state.ts index 7a4c10b1f..f0df0d412 100644 --- a/web/components/stores/application-state.ts +++ b/web/components/stores/application-state.ts @@ -57,12 +57,12 @@ const GOODBYE_STATE: AppStateOptions = { }; export enum AppStateEvent { - Loading = 'LOADING', - Loaded = 'LOADED', - Online = 'ONLINE', - Offline = 'OFFLINE', // Have not pulled configuration data from the server. - NeedsRegister = 'NEEDS_REGISTER', - Fail = 'FAIL', + Loading = 'LOADING', // Have not pulled configuration data from the server. + Loaded = 'LOADED', // Configuration data has been pulled from the server. + Online = 'ONLINE', // Stream is live + Offline = 'OFFLINE', // Stream is not live + NeedsRegister = 'NEEDS_REGISTER', // Needs to register a chat user + Fail = 'FAIL', // Error } const appStateModel = @@ -73,9 +73,7 @@ const appStateModel = predictableActionArguments: true, states: { loading: { - meta: { - ...LOADING_STATE, - }, + meta: LOADING_STATE, on: { NEEDS_REGISTER: { target: 'loading',