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

* fix: custom attributes not being synced in intercom

* fix: ssrInit
This commit is contained in:
Somay Chauhan authored and GitHub committed 2024-04-16 11:03:45 +01:00
1 parent 1606272850
commit b61820d354
3 files changed
+7 -3

No files matched your search

+1
View File
@@ -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;
@@ -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`);
+5 -3
View File
@@ -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 =