mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-20 10:52:08 +08:00
perf(ui): memoize derived validation and list computations
The TUN dialog re-split its route-exclusion list, the rule provider dialog re-sorted its entries and the group-delays hook re-stringified its group key on every render; each now recomputes only when its input identity changes. The provider-button hunk re-indents its JSX block because the sorted entries moved out of the render expression.
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
} from '@mui/material'
|
||||
import { useLockFn } from 'ahooks'
|
||||
import type { Ref } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import {
|
||||
@@ -58,8 +58,9 @@ export function TunViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
||||
dnsMode: '',
|
||||
})
|
||||
|
||||
const routeExcludeAddressItems = splitRouteExcludeAddress(
|
||||
values.routeExcludeAddress,
|
||||
const routeExcludeAddressItems = useMemo(
|
||||
() => splitRouteExcludeAddress(values.routeExcludeAddress),
|
||||
[values.routeExcludeAddress],
|
||||
)
|
||||
const routeExcludeAddressError =
|
||||
values.autoRoute &&
|
||||
|
||||
Reference in New Issue
Block a user