perf(ui): hoist static style, menu and OS identities

Dialog controls rebuilt static option arrays, style objects and label
maps on every render; the sysproxy viewer also probed the OS and split
the default bypass string per render. These are now module constants or
single memos keyed on their real inputs (translation function, active
stage).
This commit is contained in:
Tunglies
2026-11-19 23:16:25 +08:00
parent 3f7af9ab02
commit a85566a2cb
7 changed files with 118 additions and 88 deletions
+3 -2
View File
@@ -5,6 +5,8 @@ import { type PointerEvent, useCallback } from 'react'
import { useWindowControls } from '@/hooks/use-window'
import getSystem from '@/utils/get-system'
const OS = getSystem()
const RESIZE_HANDLES = [
{ direction: 'North', position: 'north' },
{ direction: 'NorthEast', position: 'north-east' },
@@ -38,7 +40,7 @@ export const WindowResizeHandles = () => {
[currentWindow],
)
if (getSystem() !== 'linux' || maximized) return null
if (OS !== 'linux' || maximized) return null
return (
<div
@@ -59,7 +61,6 @@ export const WindowResizeHandles = () => {
}
export const WindowControls = () => {
const OS = getSystem()
const { maximized, minimize, close, toggleMaximize } = useWindowControls()
// 通过前端对 tauri 窗口进行翻转全屏时会短暂地与系统图标重叠渲染。