Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove meteor from settingsOnLoadSiteUrl.ts #34994

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion apps/meteor/app/lib/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './startup/settingsOnLoadSiteUrl';
import '../lib/MessageTypes';
import './OAuthProxy';
import './methods/sendMessage';
Expand Down
14 changes: 0 additions & 14 deletions apps/meteor/app/lib/client/startup/settingsOnLoadSiteUrl.ts

This file was deleted.

3 changes: 3 additions & 0 deletions apps/meteor/client/views/root/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import PageLoading from './PageLoading';
import { useEscapeKeyStroke } from './hooks/useEscapeKeyStroke';
import { useGoogleTagManager } from './hooks/useGoogleTagManager';
import { useMessageLinkClicks } from './hooks/useMessageLinkClicks';
import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl';
import { useAnalytics } from '../../../app/analytics/client/loadScript';
import { useAnalyticsEventTracking } from '../../hooks/useAnalyticsEventTracking';
import { useLoadRoomForAllowedAnonymousRead } from '../../hooks/useLoadRoomForAllowedAnonymousRead';
Expand All @@ -29,6 +30,8 @@ const AppLayout = () => {
useLoadRoomForAllowedAnonymousRead();
useNotifyUser();

useSettingsOnLoadSiteUrl();

const layout = useSyncExternalStore(appLayout.subscribe, appLayout.getSnapshot);

return (
Expand Down
14 changes: 14 additions & 0 deletions apps/meteor/client/views/root/hooks/useSettingsOnLoadSiteUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';

export const useSettingsOnLoadSiteUrl = () => {
const siteUrl = useSetting('Site_Url') as string;

useEffect(() => {
const value = siteUrl;
if (value == null || value.trim() === '') {
return;
}
(window as any).__meteor_runtime_config__.ROOT_URL = value;
}, [siteUrl]);
};
Loading