From 302701b303db165546fe83476febebffd877ff18 Mon Sep 17 00:00:00 2001
From: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
Date: Mon, 2 Mar 2026 17:19:15 +0800
Subject: [PATCH] chore: remove serwist
---
web/app/components/provider/serwist.tsx | 43 ---
web/app/layout.tsx | 57 ++--
web/app/serwist/[path]/route.ts | 12 -
web/app/sw.ts | 59 ----
web/next.config.ts | 1 -
web/package.json | 3 -
web/pnpm-lock.yaml | 350 +-----------------------
web/public/_offline.html | 129 ---------
8 files changed, 29 insertions(+), 625 deletions(-)
delete mode 100644 web/app/components/provider/serwist.tsx
delete mode 100644 web/app/serwist/[path]/route.ts
delete mode 100644 web/app/sw.ts
delete mode 100644 web/public/_offline.html
diff --git a/web/app/components/provider/serwist.tsx b/web/app/components/provider/serwist.tsx
deleted file mode 100644
index 0cab1bce5d..0000000000
--- a/web/app/components/provider/serwist.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-'use client'
-
-import { SerwistProvider } from '@serwist/turbopack/react'
-import { useEffect } from 'react'
-import { IS_DEV } from '@/config'
-import { env } from '@/env'
-import { isClient } from '@/utils/client'
-
-export function PWAProvider({ children }: { children: React.ReactNode }) {
- if (IS_DEV) {
- return {children}
- }
-
- const basePath = env.NEXT_PUBLIC_BASE_PATH
- const swUrl = `${basePath}/serwist/sw.js`
-
- return (
-
- {children}
-
- )
-}
-
-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.tsx
index a19d5e1e57..94b54cea6c 100644
--- a/web/app/layout.tsx
+++ b/web/app/layout.tsx
@@ -12,7 +12,6 @@ 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 { PWAProvider } from './components/provider/serwist'
import SentryInitializer from './components/sentry-initializer'
import RoutePrefixHandle from './routePrefixHandle'
import './styles/globals.css'
@@ -60,35 +59,33 @@ const LocaleLayout = async ({
className="color-scheme h-full select-auto"
{...datasetMap}
>
-
-
-
-
-
-
-
-
-
-
-
- {children}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {children}
+
+
+
+
+
+
+
+
+
+