修复设备列表无限请求数据的问题

This commit is contained in:
柳清爽
2025-03-31 12:04:59 +08:00
parent dfe73f9a22
commit c4698bd22a
78 changed files with 370 additions and 14224 deletions

View File

@@ -0,0 +1,18 @@
"use client"
import { useState, useEffect, type ReactNode } from 'react'
/**
* ClientOnly组件
* 该组件专门用于包装那些只能在客户端渲染的内容,避免水合不匹配错误
* 例如使用了Math.random()、Date.now()或window对象的组件
*/
export default function ClientOnly({ children, fallback = null }: { children: ReactNode, fallback?: ReactNode }) {
const [isClient, setIsClient] = useState(false)
useEffect(() => {
setIsClient(true)
}, [])
return isClient ? <>{children}</> : <>{fallback}</>
}