From 30b6af4ff3a58a2a0187304206ff03b8889bf255 Mon Sep 17 00:00:00 2001
From: Charis <26616127+charislam@users.noreply.github.com>
Date: Fri, 25 Apr 2025 15:22:06 -0400
Subject: [PATCH] fix (docs): non-platform integrations page (#35285)
There were two bugs when trying to run the integrations page locally
with NEXT_PUBLIC_IS_PLATFORM=false:
1. The IS_PLATFORM check imported from common was not evaluating
correctly to a boolean. This is because I slapped a 'use client' on the
entire common package last year -_-""" which caused all its imports to
be evaluated to functions when used in server components. I have now
moved the 'use client's down to the submodules that actually need it.
2. When the integrations submenu is empty, the navigation menu errors
out because it expects all navigation items to either have children or
have links. Have updated this to gracefully hide empty headers.
---
.../NavigationMenu/NavigationMenuGuideListItems.tsx | 4 ++--
packages/common/feature-flags.tsx | 6 ++++--
packages/common/helpers.ts | 2 ++
packages/common/hooks/index.ts | 2 ++
packages/common/index.tsx | 2 --
packages/common/telemetry.tsx | 2 ++
6 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
index cef95a4119e..cc6c052a369 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
@@ -169,9 +169,9 @@ const Content = (props) => {
)
})}
- ) : (
+ ) : x.url ? (
- )}
+ ) : null}
)
})}
diff --git a/packages/common/feature-flags.tsx b/packages/common/feature-flags.tsx
index f79131f2fea..8e85b519fd4 100644
--- a/packages/common/feature-flags.tsx
+++ b/packages/common/feature-flags.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { FlagValues } from '@vercel/flags/react'
import { createContext, PropsWithChildren, useContext, useEffect, useState } from 'react'
@@ -123,9 +125,9 @@ export const FeatureFlagProvider = ({
return (
- {/*
+ {/*
[Joshen] Just support configcat flags in Vercel flags for now for simplicity
- although I think it should be fairly simply to support PH too
+ although I think it should be fairly simply to support PH too
*/}
{children}
diff --git a/packages/common/helpers.ts b/packages/common/helpers.ts
index 749eb556a4d..d48bd3a8b0f 100644
--- a/packages/common/helpers.ts
+++ b/packages/common/helpers.ts
@@ -1,3 +1,5 @@
+'use client'
+
import { useSyncExternalStore } from 'react'
import type * as React from 'react'
diff --git a/packages/common/hooks/index.ts b/packages/common/hooks/index.ts
index 0e3a707f73b..5f6e518e4ac 100644
--- a/packages/common/hooks/index.ts
+++ b/packages/common/hooks/index.ts
@@ -1,3 +1,5 @@
+'use client'
+
export * from './useAnchorObserver'
export * from './useBreakpoint'
export * from './useConstant'
diff --git a/packages/common/index.tsx b/packages/common/index.tsx
index 25a77e6adb4..bb0ac6c5552 100644
--- a/packages/common/index.tsx
+++ b/packages/common/index.tsx
@@ -1,5 +1,3 @@
-'use client'
-
export * from './auth'
export * from './constants'
export * from './database-types'
diff --git a/packages/common/telemetry.tsx b/packages/common/telemetry.tsx
index 18d46f585cf..29278df8cfa 100644
--- a/packages/common/telemetry.tsx
+++ b/packages/common/telemetry.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { components } from 'api-types'
import { useRouter } from 'next/compat/router'
import { usePathname } from 'next/navigation'