From 33eaedab44775b05ecc787eb107afc8c2b40eb6a Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 8 Dec 2025 17:28:59 +0530 Subject: [PATCH 1/4] chore: move startup event to react --- apps/meteor/client/startup/startup.ts | 2 -- apps/meteor/client/views/root/AppLayout.tsx | 2 ++ .../client/views/root/hooks/useStartupEvent.ts | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 apps/meteor/client/views/root/hooks/useStartupEvent.ts diff --git a/apps/meteor/client/startup/startup.ts b/apps/meteor/client/startup/startup.ts index 652b85045f19a..45fa6c12b1bbb 100644 --- a/apps/meteor/client/startup/startup.ts +++ b/apps/meteor/client/startup/startup.ts @@ -10,8 +10,6 @@ import { fireGlobalEvent } from '../lib/utils/fireGlobalEvent'; import { watchUserId } from '../meteor/user'; Meteor.startup(() => { - fireGlobalEvent('startup', true); - let status: UserStatus | undefined = undefined; Tracker.autorun(async () => { const uid = watchUserId(); diff --git a/apps/meteor/client/views/root/AppLayout.tsx b/apps/meteor/client/views/root/AppLayout.tsx index 6daac59b4f863..ff63478982177 100644 --- a/apps/meteor/client/views/root/AppLayout.tsx +++ b/apps/meteor/client/views/root/AppLayout.tsx @@ -30,6 +30,7 @@ import { useMessageLinkClicks } from './hooks/useMessageLinkClicks'; import { useNotificationPermission } from './hooks/useNotificationPermission'; import { useRedirectToSetupWizard } from './hooks/useRedirectToSetupWizard'; import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl'; +import useStartupEvent from './hooks/useStartupEvent'; import { appLayout } from '../../lib/appLayout'; const AppLayout = () => { @@ -69,6 +70,7 @@ const AppLayout = () => { useLoadMissedMessages(); useDesktopFavicon(); useDesktopTitle(); + useStartupEvent(); const layout = useSyncExternalStore(appLayout.subscribe, appLayout.getSnapshot); diff --git a/apps/meteor/client/views/root/hooks/useStartupEvent.ts b/apps/meteor/client/views/root/hooks/useStartupEvent.ts new file mode 100644 index 0000000000000..8d2d6dd44579d --- /dev/null +++ b/apps/meteor/client/views/root/hooks/useStartupEvent.ts @@ -0,0 +1,13 @@ +import { useEffect } from 'react'; + +import { useFireGlobalEvent } from '../../../hooks/useFireGlobalEvent'; + +const useStartupEvent = () => { + const { mutate: fireStartupEvent } = useFireGlobalEvent('startup'); + + useEffect(() => { + fireStartupEvent(true); + }, [fireStartupEvent]); +}; + +export default useStartupEvent; From 4d307747608dfcdd65a17292614e0aeecb986e07 Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 8 Dec 2025 17:37:27 +0530 Subject: [PATCH 2/4] fix hook export --- apps/meteor/client/views/root/AppLayout.tsx | 2 +- apps/meteor/client/views/root/hooks/useStartupEvent.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/meteor/client/views/root/AppLayout.tsx b/apps/meteor/client/views/root/AppLayout.tsx index ff63478982177..33b0714ba3d30 100644 --- a/apps/meteor/client/views/root/AppLayout.tsx +++ b/apps/meteor/client/views/root/AppLayout.tsx @@ -30,7 +30,7 @@ import { useMessageLinkClicks } from './hooks/useMessageLinkClicks'; import { useNotificationPermission } from './hooks/useNotificationPermission'; import { useRedirectToSetupWizard } from './hooks/useRedirectToSetupWizard'; import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl'; -import useStartupEvent from './hooks/useStartupEvent'; +import { useStartupEvent } from './hooks/useStartupEvent'; import { appLayout } from '../../lib/appLayout'; const AppLayout = () => { diff --git a/apps/meteor/client/views/root/hooks/useStartupEvent.ts b/apps/meteor/client/views/root/hooks/useStartupEvent.ts index 8d2d6dd44579d..93936526db594 100644 --- a/apps/meteor/client/views/root/hooks/useStartupEvent.ts +++ b/apps/meteor/client/views/root/hooks/useStartupEvent.ts @@ -2,12 +2,10 @@ import { useEffect } from 'react'; import { useFireGlobalEvent } from '../../../hooks/useFireGlobalEvent'; -const useStartupEvent = () => { +export const useStartupEvent = () => { const { mutate: fireStartupEvent } = useFireGlobalEvent('startup'); useEffect(() => { fireStartupEvent(true); }, [fireStartupEvent]); }; - -export default useStartupEvent; From 84d0ce2ab3255b758d20412e74cc8ed480f9728d Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 8 Dec 2025 17:41:52 +0530 Subject: [PATCH 3/4] add changeset --- .changeset/tender-wolves-promise.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tender-wolves-promise.md diff --git a/.changeset/tender-wolves-promise.md b/.changeset/tender-wolves-promise.md new file mode 100644 index 0000000000000..234a01290239b --- /dev/null +++ b/.changeset/tender-wolves-promise.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Fixes the missing dispatch of `startup` iframe event on client startup. From 157d407093d7c48552b88f6cfa5e63c636abdcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Jaeger=20Foresti?= <60678893+juliajforesti@users.noreply.github.com> Date: Mon, 8 Dec 2025 12:27:03 -0300 Subject: [PATCH 4/4] fix: add scope to `fireStartupEvent` Co-authored-by: gabriellsh <40830821+gabriellsh@users.noreply.github.com> --- apps/meteor/client/views/root/hooks/useStartupEvent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/client/views/root/hooks/useStartupEvent.ts b/apps/meteor/client/views/root/hooks/useStartupEvent.ts index 93936526db594..43bbb2451bd36 100644 --- a/apps/meteor/client/views/root/hooks/useStartupEvent.ts +++ b/apps/meteor/client/views/root/hooks/useStartupEvent.ts @@ -3,7 +3,7 @@ import { useEffect } from 'react'; import { useFireGlobalEvent } from '../../../hooks/useFireGlobalEvent'; export const useStartupEvent = () => { - const { mutate: fireStartupEvent } = useFireGlobalEvent('startup'); + const { mutate: fireStartupEvent } = useFireGlobalEvent('startup', 'global'); useEffect(() => { fireStartupEvent(true);