Skip to content

Scheduling infrastructure for absolutely everyone.

fix: custom attributes not being synced in intercom (#14600)

Somay Chauhanb61820d3543f
diff --git a/apps/web/server/lib/ssr.ts b/apps/web/server/lib/ssr.ts
index 64632ad5e1d..11cf707e9c4 100644
--- a/apps/web/server/lib/ssr.ts
+++ b/apps/web/server/lib/ssr.ts
@@ -81,6 +81,7 @@ export async function ssrInit(context: GetServerSidePropsContext, options?: { no
// Provides a better UX to the users who have already upgraded.
ssr.viewer.teams.hasTeamPlan.prefetch(),
ssr.viewer.public.session.prefetch(),
+ ssr.viewer.me.prefetch(),
]);
return ssr;
diff --git a/packages/features/ee/support/lib/intercom/useIntercom.ts b/packages/features/ee/support/lib/intercom/useIntercom.ts
index 3eeac1823b5..9e81af59206 100644
--- a/packages/features/ee/support/lib/intercom/useIntercom.ts
+++ b/packages/features/ee/support/lib/intercom/useIntercom.ts
@@ -28,6 +28,7 @@ export const useIntercom = () => {
const { hasTeamPlan } = useHasTeamPlan();
const boot = async () => {
+ if (!data) return;
let userHash;
const req = await fetch(`/api/intercom-hash`);
diff --git a/packages/features/shell/Shell.tsx b/packages/features/shell/Shell.tsx
index 38aed530fa1..911bb2db70e 100644
--- a/packages/features/shell/Shell.tsx
+++ b/packages/features/shell/Shell.tsx
@@ -215,15 +215,17 @@ const useBanners = () => {
const Layout = (props: LayoutProps) => {
const banners = useBanners();
- const showIntercom = localStorage.getItem("showIntercom");
+ const { data: user } = trpc.viewer.me.useQuery();
const { boot } = useIntercom();
const pageTitle = typeof props.heading === "string" && !props.title ? props.heading : props.title;
useEffect(() => {
// not using useMediaQuery as it toggles between true and false
- if (showIntercom === "false" || window.innerWidth <= 768) return;
+ const showIntercom = localStorage.getItem("showIntercom");
+ if (showIntercom === "false" || window.innerWidth <= 768 || !user) return;
boot();
- }, [showIntercom]);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [user]);
const bannersHeight = useMemo(() => {
const activeBanners =