Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion src/components/layout/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 9 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
18 changes: 12 additions & 6 deletions src/stores/blockly-store.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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
Expand All @@ -49,11 +49,15 @@ export default class BlocklyStore {
checkForSavedBots = async (): Promise<void> => {
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;
});
}
};

Expand All @@ -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');
});
}
};

Expand Down
11 changes: 6 additions & 5 deletions src/stores/google-drive-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
Loading