From 00dfa629b504649e1da7d0ef9434a18780984cf7 Mon Sep 17 00:00:00 2001 From: Matti Nannt Date: Thu, 15 May 2025 17:46:05 +0200 Subject: [PATCH] fix: build process warnings (#5734) Co-authored-by: Dhruwang --- .../[surveyId]/(analysis)/summary/lib/survey-qr-code.tsx | 2 +- apps/web/lib/utils/hooks/useIntervalWhenFocused.ts | 8 ++++---- apps/web/next.config.mjs | 5 ----- packages/logger/src/logger.ts | 3 +++ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey-qr-code.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey-qr-code.tsx index 2a74b21961..700739b482 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey-qr-code.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey-qr-code.tsx @@ -28,7 +28,7 @@ export const useSurveyQRCode = (surveyUrl: string) => { } catch (error) { toast.error(t("environments.surveys.summary.failed_to_generate_qr_code")); } - }, [surveyUrl]); + }, [surveyUrl, t]); const downloadQRCode = () => { try { diff --git a/apps/web/lib/utils/hooks/useIntervalWhenFocused.ts b/apps/web/lib/utils/hooks/useIntervalWhenFocused.ts index b2b0df42b0..bf800bad1d 100644 --- a/apps/web/lib/utils/hooks/useIntervalWhenFocused.ts +++ b/apps/web/lib/utils/hooks/useIntervalWhenFocused.ts @@ -1,4 +1,4 @@ -import { useEffect, useRef } from "react"; +import { useCallback, useEffect, useRef } from "react"; export const useIntervalWhenFocused = ( callback: () => void, @@ -8,7 +8,7 @@ export const useIntervalWhenFocused = ( ) => { const intervalRef = useRef(null); - const handleFocus = () => { + const handleFocus = useCallback(() => { if (isActive) { if (shouldExecuteImmediately) { // Execute the callback immediately when the tab comes into focus @@ -20,7 +20,7 @@ export const useIntervalWhenFocused = ( callback(); }, intervalDuration); } - }; + }, [isActive, intervalDuration, callback, shouldExecuteImmediately]); const handleBlur = () => { // Clear the interval when the tab loses focus @@ -46,7 +46,7 @@ export const useIntervalWhenFocused = ( window.removeEventListener("focus", handleFocus); window.removeEventListener("blur", handleBlur); }; - }, [isActive, intervalDuration]); + }, [isActive, intervalDuration, handleFocus]); }; export default useIntervalWhenFocused; diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index ddc3bfc9df..58115e0f9d 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -26,11 +26,6 @@ const nextConfig = { "app/api/packages": ["../../packages/js-core/dist/*", "../../packages/surveys/dist/*"], "/api/auth/**/*": ["../../node_modules/jose/**/*"], }, - i18n: { - locales: ["en-US", "de-DE", "fr-FR", "pt-BR", "zh-Hant-TW", "pt-PT"], - localeDetection: false, - defaultLocale: "en-US", - }, experimental: {}, transpilePackages: ["@formbricks/database"], images: { diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index 5401c4f3f6..782a7b4b12 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -2,10 +2,13 @@ import Pino, { type Logger, type LoggerOptions, stdSerializers } from "pino"; import { type TLogLevel, ZLogLevel } from "../types/logger"; const IS_PRODUCTION = !process.env.NODE_ENV || process.env.NODE_ENV === "production"; +const IS_BUILD = process.env.NEXT_PHASE === "phase-production-build"; + const getLogLevel = (): TLogLevel => { let logLevel: TLogLevel = "info"; if (IS_PRODUCTION) logLevel = "warn"; + if (IS_BUILD) logLevel = "error"; // Only show errors during build const envLogLevel = process.env.LOG_LEVEL;