diff --git a/rsbuild.config.ts b/rsbuild.config.ts index b9483b38..9d647cb6 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -33,8 +33,8 @@ export default defineConfig({ APP_ENV: JSON.stringify(process.env.APP_ENV), REF_NAME: JSON.stringify(process.env.REF_NAME), REMOTE_CONFIG_URL: JSON.stringify(process.env.REMOTE_CONFIG_URL), - GD_CLIENT_ID: JSON.stringify(process.env.GD_CLIENT_ID), - GD_APP_ID: JSON.stringify(process.env.GD_APP_ID), + //GD_CLIENT_ID: JSON.stringify(process.env.GD_CLIENT_ID), + //GD_APP_ID: JSON.stringify(process.env.GD_APP_ID), GD_API_KEY: JSON.stringify(process.env.GD_API_KEY), DATADOG_SESSION_REPLAY_SAMPLE_RATE: JSON.stringify(process.env.DATADOG_SESSION_REPLAY_SAMPLE_RATE), DATADOG_SESSION_SAMPLE_RATE: JSON.stringify(process.env.DATADOG_SESSION_SAMPLE_RATE), diff --git a/src/components/layout/header/header.tsx b/src/components/layout/header/header.tsx index a7f08e3c..285503f7 100644 --- a/src/components/layout/header/header.tsx +++ b/src/components/layout/header/header.tsx @@ -70,7 +70,6 @@ const AppHeader = observer(({ isAuthenticating }: TAppHeaderProps) => { } }, [setIsAuthorizing]); - console.log('Rendering AppHeader', isAuthorized, isAuthorizing); const renderAccountSection = useCallback(() => { // Show loader during various loading states if (isAuthorizing) { diff --git a/src/main.tsx b/src/main.tsx index 2bdd656d..2b2df50a 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -4,8 +4,15 @@ import { AuthWrapper } from './app/AuthWrapper'; import { AnalyticsInitializer } from './utils/analytics'; import './styles/index.scss'; -// Configure MobX to handle multiple instances in production builds -configure({ isolateGlobalState: true }); +// Configure MobX to handle multiple instances in production builds and disable strict mode warnings +configure({ + isolateGlobalState: true, + enforceActions: 'never', + computedRequiresReaction: false, + reactionRequiresObservable: false, + observableRequiresReaction: false, + disableErrorBoundaries: true, +}); AnalyticsInitializer(); diff --git a/src/stores/blockly-store.ts b/src/stores/blockly-store.ts index 2f6de4d7..257f12f5 100644 --- a/src/stores/blockly-store.ts +++ b/src/stores/blockly-store.ts @@ -1,4 +1,4 @@ -import { action, computed, makeObservable, observable } from 'mobx'; +import { action, computed, makeObservable, observable, runInAction } from 'mobx'; import { tabs_title } from '@/constants/bot-contents'; import { getSavedWorkspaces, onWorkspaceResize } from '@/external/bot-skeleton'; import { getSetting, storeSetting } from '@/utils/settings'; @@ -27,7 +27,7 @@ export default class BlocklyStore { // Computed property to check if there's an active bot get has_active_bot(): boolean { // Check if there's an active bot in the workspace - const workspace = window.Blockly?.derivWorkspace; + const workspace = (window as any).Blockly?.derivWorkspace; if (!workspace) return false; // Check if there are any blocks in the workspace @@ -49,11 +49,15 @@ export default class BlocklyStore { checkForSavedBots = async (): Promise => { try { const workspaces = await getSavedWorkspaces(); - // Use action to update observable property - this._has_saved_bots = Array.isArray(workspaces) && workspaces.length > 0; + // Use runInAction to update observable property + runInAction(() => { + this._has_saved_bots = Array.isArray(workspaces) && workspaces.length > 0; + }); } catch (e) { console.error('Error checking for saved workspaces:', e); - this._has_saved_bots = false; + runInAction(() => { + this._has_saved_bots = false; + }); } }; @@ -76,7 +80,9 @@ export default class BlocklyStore { getCachedActiveTab = (): void => { if (getSetting('active_tab')) { - this.active_tab = getSetting('active_tab'); + runInAction(() => { + this.active_tab = getSetting('active_tab'); + }); } }; diff --git a/src/stores/google-drive-store.ts b/src/stores/google-drive-store.ts index bc975925..f7f7b981 100644 --- a/src/stores/google-drive-store.ts +++ b/src/stores/google-drive-store.ts @@ -2,7 +2,7 @@ import { action, makeObservable, observable } from 'mobx'; import { botNotification } from '@/components/bot-notification/bot-notification'; import { notification_message } from '@/components/bot-notification/bot-notification-utils'; import { button_status } from '@/constants/button-status'; -import { config, importExternal } from '@/external/bot-skeleton'; +import { config } from '@/external/bot-skeleton'; import { getInitialLanguage, localize } from '@deriv-com/translations'; import { rudderStackSendUploadStrategyCompletedEvent, @@ -64,10 +64,11 @@ export default class GoogleDriveStore { this.setKey(); this.client = null; this.access_token = localStorage.getItem('google_access_token') ?? ''; - setTimeout(() => { - importExternal('https://accounts.google.com/gsi/client').then(() => this.initialiseClient()); - importExternal('https://apis.google.com/js/api.js').then(() => this.initialise()); - }, 3000); + //NOTE : TO be done later when we get the tokens + // setTimeout(() => { + // importExternal('https://accounts.google.com/gsi/client').then(() => this.initialiseClient()); + // importExternal('https://apis.google.com/js/api.js').then(() => this.initialise()); + // }, 3000); } is_google_drive_token_valid = true;