🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
⚡️ perf(spa): lazy import spaHtmlTemplates to reduce initial bundle (#12526)
Inneia5c454589d09
diff --git a/src/app/spa/[variants]/[[...path]]/route.ts b/src/app/spa/[variants]/[[...path]]/route.tsindex 88f71da517c..883befa0a95 100644--- a/src/app/spa/[variants]/[[...path]]/route.ts+++ b/src/app/spa/[variants]/[[...path]]/route.ts@@ -92,7 +92,7 @@ async function getTemplate(isMobile: boolean): Promise<string> {if (isDev) {const res = await fetch(VITE_DEV_ORIGIN);const html = await res.text();- return await rewriteViteAssetUrls(html);+ return rewriteViteAssetUrls(html);}const { desktopHtmlTemplate, mobileHtmlTemplate } = await import('./spaHtmlTemplates');diff --git a/src/components/Analytics/Google.tsx b/src/components/Analytics/Google.tsxindex 496da8e7611..cd86e2c75f6 100644--- a/src/components/Analytics/Google.tsx+++ b/src/components/Analytics/Google.tsx@@ -2,10 +2,11 @@import { memo, useEffect } from 'react';-import { analyticsEnv } from '@/envs/analytics';+interface GoogleAnalyticsProps {+ gaId?: string;+}-const GoogleAnalytics = memo(() => {- const gaId = analyticsEnv.GOOGLE_ANALYTICS_MEASUREMENT_ID;+const GoogleAnalytics = memo<GoogleAnalyticsProps>(({ gaId }) => {useEffect(() => {if (!gaId) return;diff --git a/src/components/Analytics/LobeAnalyticsProviderWrapper.tsx b/src/components/Analytics/LobeAnalyticsProviderWrapper.tsxindex bb83ba32974..4b449a7c4b8 100644--- a/src/components/Analytics/LobeAnalyticsProviderWrapper.tsx+++ b/src/components/Analytics/LobeAnalyticsProviderWrapper.tsx@@ -2,7 +2,7 @@ import { type ReactNode } from 'react';import { memo } from 'react';import { LobeAnalyticsProvider } from '@/components/Analytics/LobeAnalyticsProvider';-import { analyticsEnv } from '@/envs/analytics';+import type { SPAServerConfig } from '@/types/spaServerConfig';import { isDev } from '@/utils/env';type Props = {@@ -10,21 +10,24 @@ type Props = {};export const LobeAnalyticsProviderWrapper = memo<Props>(({ children }) => {+ const serverConfig: SPAServerConfig | undefined = window.__SERVER_CONFIG__;+ const analytics = serverConfig?.analyticsConfig;+return (<LobeAnalyticsProviderga4Config={{debug: isDev,- enabled: analyticsEnv.ENABLE_GOOGLE_ANALYTICS,+ enabled: !!analytics?.google?.measurementId,gtagConfig: {debug_mode: isDev,},- measurementId: analyticsEnv.GOOGLE_ANALYTICS_MEASUREMENT_ID ?? '',+ measurementId: analytics?.google?.measurementId ?? '',}}postHogConfig={{- debug: analyticsEnv.DEBUG_POSTHOG_ANALYTICS,- enabled: analyticsEnv.ENABLED_POSTHOG_ANALYTICS,- host: analyticsEnv.POSTHOG_HOST,- key: analyticsEnv.POSTHOG_KEY ?? '',+ debug: analytics?.posthog?.debug ?? false,+ enabled: !!analytics?.posthog?.key,+ host: analytics?.posthog?.host ?? '',+ key: analytics?.posthog?.key ?? '',person_profiles: 'always',}}>diff --git a/src/components/Analytics/LobeAnalyticsProviderWrapper.vite.tsx b/src/components/Analytics/LobeAnalyticsProviderWrapper.vite.tsxdeleted file mode 100644index 4b449a7c4b8..00000000000--- a/src/components/Analytics/LobeAnalyticsProviderWrapper.vite.tsx+++ /dev/null@@ -1,39 +0,0 @@-import { type ReactNode } from 'react';-import { memo } from 'react';--import { LobeAnalyticsProvider } from '@/components/Analytics/LobeAnalyticsProvider';-import type { SPAServerConfig } from '@/types/spaServerConfig';-import { isDev } from '@/utils/env';--type Props = {- children: ReactNode;-};--export const LobeAnalyticsProviderWrapper = memo<Props>(({ children }) => {- const serverConfig: SPAServerConfig | undefined = window.__SERVER_CONFIG__;- const analytics = serverConfig?.analyticsConfig;-- return (- <LobeAnalyticsProvider- ga4Config={{- debug: isDev,- enabled: !!analytics?.google?.measurementId,- gtagConfig: {- debug_mode: isDev,- },- measurementId: analytics?.google?.measurementId ?? '',- }}- postHogConfig={{- debug: analytics?.posthog?.debug ?? false,- enabled: !!analytics?.posthog?.key,- host: analytics?.posthog?.host ?? '',- key: analytics?.posthog?.key ?? '',- person_profiles: 'always',- }}- >- {children}- </LobeAnalyticsProvider>- );-});--LobeAnalyticsProviderWrapper.displayName = 'LobeAnalyticsProviderWrapper';diff --git a/src/components/Analytics/Vercel.tsx b/src/components/Analytics/Vercel.tsxindex 73ab7013137..0cfca3119db 100644--- a/src/components/Analytics/Vercel.tsx+++ b/src/components/Analytics/Vercel.tsx@@ -1,8 +1,10 @@import { Analytics } from '@vercel/analytics/react';import { memo } from 'react';-import { analyticsEnv } from '@/envs/analytics';+interface VercelAnalyticsProps {+ debug?: boolean;+}-const VercelAnalytics = memo(() => <Analytics debug={analyticsEnv.DEBUG_VERCEL_ANALYTICS} />);+const VercelAnalytics = memo<VercelAnalyticsProps>(({ debug }) => <Analytics debug={debug} />);export default VercelAnalytics;diff --git a/src/components/Analytics/index.tsx b/src/components/Analytics/index.tsxindex 101e9b6893b..f24b8999edd 100644--- a/src/components/Analytics/index.tsx+++ b/src/components/Analytics/index.tsx@@ -14,8 +14,12 @@ const ReactScan = dynamic(() => import('./ReactScan'));const Analytics = () => {return (<>- {analyticsEnv.ENABLE_VERCEL_ANALYTICS && <Vercel />}- {analyticsEnv.ENABLE_GOOGLE_ANALYTICS && <Google />}+ {analyticsEnv.ENABLE_VERCEL_ANALYTICS && (+ <Vercel debug={analyticsEnv.DEBUG_VERCEL_ANALYTICS} />+ )}+ {analyticsEnv.ENABLE_GOOGLE_ANALYTICS && (+ <Google gaId={analyticsEnv.GOOGLE_ANALYTICS_MEASUREMENT_ID} />+ )}{analyticsEnv.ENABLED_PLAUSIBLE_ANALYTICS && (<Plausibledomain={analyticsEnv.PLAUSIBLE_DOMAIN}