Compare commits

...

1 Commits

Author SHA1 Message Date
Cursor Agent
0a1816786b fix: resolve viewport undefined error in custom scripts
Fixes FORMBRICKS-NG

The issue was caused by importing and re-exporting the viewport constant
from a shared module in the survey layout file. This re-export pattern
could cause bundling issues where the viewport variable name leaked into
the global scope or interfered with custom scripts.

Changes:
- Define viewport export directly in app/s/[surveyId]/layout.tsx
- Remove viewport export from modules/survey/link/layout.tsx to prevent
  scope pollution
- This ensures viewport metadata stays scoped to Next.js and doesn't
  conflict with custom scripts that may define their own viewport variables
2026-02-20 16:02:57 +00:00
2 changed files with 9 additions and 12 deletions

View File

@@ -1,5 +1,12 @@
import { LinkSurveyLayout, viewport } from "@/modules/survey/link/layout";
import { Viewport } from "next";
import { LinkSurveyLayout } from "@/modules/survey/link/layout";
export { viewport };
export const viewport: Viewport = {
width: "device-width",
initialScale: 1.0,
maximumScale: 1.0,
userScalable: false,
viewportFit: "contain",
};
export default LinkSurveyLayout;

View File

@@ -1,13 +1,3 @@
import { Viewport } from "next";
export const viewport: Viewport = {
width: "device-width",
initialScale: 1.0,
maximumScale: 1.0,
userScalable: false,
viewportFit: "contain",
};
export const LinkSurveyLayout = ({ children }) => {
return <div className="h-dvh">{children}</div>;
};