Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: disable serwist in dev (#31424)
Stephen Zhouf911199c8e06
diff --git a/web/app/components/provider/serwist.tsx b/web/app/components/provider/serwist.tsxindex 39a80f5ac2c..2eef43a7d6d 100644--- a/web/app/components/provider/serwist.tsx+++ b/web/app/components/provider/serwist.tsx@@ -1,3 +1,42 @@'use client'-export { SerwistProvider } from '@serwist/turbopack/react'+import { SerwistProvider } from '@serwist/turbopack/react'+import { useEffect } from 'react'+import { IS_DEV } from '@/config'+import { isClient } from '@/utils/client'++export function PWAProvider({ children }: { children: React.ReactNode }) {+ if (IS_DEV) {+ return <DisabledPWAProvider>{children}</DisabledPWAProvider>+ }++ const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ''+ const swUrl = `${basePath}/serwist/sw.js`++ return (+ <SerwistProvider swUrl={swUrl}>+ {children}+ </SerwistProvider>+ )+}++function DisabledPWAProvider({ children }: { children: React.ReactNode }) {+ useEffect(() => {+ if (isClient && 'serviceWorker' in navigator) {+ navigator.serviceWorker.getRegistrations()+ .then((registrations) => {+ registrations.forEach((registration) => {+ registration.unregister()+ .catch((error) => {+ console.error('Error unregistering service worker:', error)+ })+ })+ })+ .catch((error) => {+ console.error('Error unregistering service workers:', error)+ })+ }+ }, [])++ return <>{children}</>+}diff --git a/web/app/layout.tsx b/web/app/layout.tsxindex b970fddc7a4..845cae2d4ec 100644--- a/web/app/layout.tsx+++ b/web/app/layout.tsx@@ -12,7 +12,7 @@ import { ToastProvider } from './components/base/toast'import BrowserInitializer from './components/browser-initializer'import { ReactScanLoader } from './components/devtools/react-scan/loader'import { I18nServerProvider } from './components/provider/i18n-server'-import { SerwistProvider } from './components/provider/serwist'+import { PWAProvider } from './components/provider/serwist'import SentryInitializer from './components/sentry-initializer'import RoutePrefixHandle from './routePrefixHandle'import './styles/globals.css'@@ -40,9 +40,6 @@ const LocaleLayout = async ({}) => {const locale = await getLocaleOnServer()- const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ''- const swUrl = `${basePath}/serwist/sw.js`-const datasetMap: Record<DatasetAttr, string | undefined> = {[DatasetAttr.DATA_API_PREFIX]: process.env.NEXT_PUBLIC_API_PREFIX,[DatasetAttr.DATA_PUBLIC_API_PREFIX]: process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX,@@ -96,7 +93,7 @@ const LocaleLayout = async ({className="color-scheme h-full select-auto"{...datasetMap}>- <SerwistProvider swUrl={swUrl}>+ <PWAProvider><ReactScanLoader /><JotaiProvider><ThemeProvider@@ -124,7 +121,7 @@ const LocaleLayout = async ({</ThemeProvider></JotaiProvider><RoutePrefixHandle />- </SerwistProvider>+ </PWAProvider></body></html>)