fix(build): extract FeedbackOverlay to client wrapper to prevent ssr:false error in Server Component
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Successful in 3m3s
Build & Deploy / 🏗️ Build (push) Successful in 2m41s
Build & Deploy / 🚀 Deploy (push) Successful in 31s
Build & Deploy / 🧪 Smoke Test (push) Successful in 1m32s
Build & Deploy / 📸 Visual Diff (push) Failing after 2m4s
Build & Deploy / 🛡️ Quality Gates (push) Failing after 2m25s
Build & Deploy / ⚡ Lighthouse (push) Successful in 6m26s
Build & Deploy / ♿ WCAG (push) Successful in 5m47s
Build & Deploy / 🔔 Notify (push) Successful in 1s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Successful in 3m3s
Build & Deploy / 🏗️ Build (push) Successful in 2m41s
Build & Deploy / 🚀 Deploy (push) Successful in 31s
Build & Deploy / 🧪 Smoke Test (push) Successful in 1m32s
Build & Deploy / 📸 Visual Diff (push) Failing after 2m4s
Build & Deploy / 🛡️ Quality Gates (push) Failing after 2m25s
Build & Deploy / ⚡ Lighthouse (push) Successful in 6m26s
Build & Deploy / ♿ WCAG (push) Successful in 5m47s
Build & Deploy / 🔔 Notify (push) Successful in 1s
This commit is contained in:
@@ -7,11 +7,11 @@ import AnalyticsShell from '@/components/analytics/AnalyticsShell';
|
|||||||
import { Metadata, Viewport } from 'next';
|
import { Metadata, Viewport } from 'next';
|
||||||
import { NextIntlClientProvider } from 'next-intl';
|
import { NextIntlClientProvider } from 'next-intl';
|
||||||
import { getMessages } from 'next-intl/server';
|
import { getMessages } from 'next-intl/server';
|
||||||
import dynamic from 'next/dynamic';
|
|
||||||
import { Suspense } from 'react';
|
import { Suspense } from 'react';
|
||||||
import '../../styles/globals.css';
|
import '../../styles/globals.css';
|
||||||
import { SITE_URL } from '@/lib/schema';
|
import { SITE_URL } from '@/lib/schema';
|
||||||
import { config } from '@/lib/config';
|
import { config } from '@/lib/config';
|
||||||
|
import FeedbackClientWrapper from '@/components/FeedbackClientWrapper';
|
||||||
import { setRequestLocale } from 'next-intl/server';
|
import { setRequestLocale } from 'next-intl/server';
|
||||||
import { Inter } from 'next/font/google';
|
import { Inter } from 'next/font/google';
|
||||||
|
|
||||||
@@ -127,13 +127,6 @@ export default async function Layout(props: {
|
|||||||
// Read directly from process.env — bypasses all abstraction to guarantee correctness
|
// Read directly from process.env — bypasses all abstraction to guarantee correctness
|
||||||
const feedbackEnabled = process.env.NEXT_PUBLIC_FEEDBACK_ENABLED === 'true';
|
const feedbackEnabled = process.env.NEXT_PUBLIC_FEEDBACK_ENABLED === 'true';
|
||||||
|
|
||||||
const FeedbackOverlay = feedbackEnabled
|
|
||||||
? dynamic(
|
|
||||||
() => import('@mintel/next-feedback/FeedbackOverlay').then((mod) => mod.FeedbackOverlay),
|
|
||||||
{ ssr: false },
|
|
||||||
)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang={safeLocale} className={`scroll-smooth overflow-x-hidden ${inter.variable}`}>
|
<html lang={safeLocale} className={`scroll-smooth overflow-x-hidden ${inter.variable}`}>
|
||||||
<head>
|
<head>
|
||||||
@@ -158,7 +151,7 @@ export default async function Layout(props: {
|
|||||||
<CMSConnectivityNotice />
|
<CMSConnectivityNotice />
|
||||||
|
|
||||||
<AnalyticsShell />
|
<AnalyticsShell />
|
||||||
{FeedbackOverlay && <FeedbackOverlay />}
|
<FeedbackClientWrapper feedbackEnabled={feedbackEnabled} />
|
||||||
</NextIntlClientProvider>
|
</NextIntlClientProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
18
components/FeedbackClientWrapper.tsx
Normal file
18
components/FeedbackClientWrapper.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import dynamic from 'next/dynamic';
|
||||||
|
|
||||||
|
const FeedbackOverlay = dynamic(
|
||||||
|
() => import('@mintel/next-feedback/FeedbackOverlay').then((mod) => mod.FeedbackOverlay),
|
||||||
|
{ ssr: false },
|
||||||
|
);
|
||||||
|
|
||||||
|
interface FeedbackClientWrapperProps {
|
||||||
|
feedbackEnabled: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function FeedbackClientWrapper({ feedbackEnabled }: FeedbackClientWrapperProps) {
|
||||||
|
if (!feedbackEnabled) return null;
|
||||||
|
|
||||||
|
return <FeedbackOverlay />;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user