mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-20 10:52:08 +08:00
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:
@@ -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 窗口进行翻转全屏时会短暂地与系统图标重叠渲染。
|
||||
|
||||
Reference in New Issue
Block a user