Tunglies 45afb1c15a fix(frontend): reduce long-running memory pressure in connections (#7227)
* fix(connections): stabilize table memory usage

Render the connections table and list from stable row view models, and replace the TanStack row/cell instantiation path with a lightweight virtualized table body.

The leak was isolated to the frontend table render path: websocket data without the table stayed flat, while the normal table path kept producing large per-snapshot object graphs under active/closed churn.

Introduced-by: bf06cbc87d (introduced the TanStack table path)

Related-hot-path: 068678135 (made default ordering/filtering hot enough for long-running /connections sessions to amplify retained heap/RSS)

Related-retention-path: 7fc238c27b (moved Home stats to the full connection websocket subscription, so Home could keep connection snapshots alive for totals/count)

Keep UI behavior intact: column visibility, column order, resizing, sorting, connection details, the closed-connection cap, and the 500ms refresh cadence remain.

* fix(connections): lazily release connection snapshots

Keep the full active/closed connection snapshot scoped to /connections by using a short React Query gcTime for the full subscription.

Home now subscribes to a lightweight connection summary for totals and active count, so leaving /connections no longer keeps the full active/closed arrays and closed history alive for the dashboard.

Only the selected Active or Closed mode feeds filtering, sorting, row-view derivation, and table/list rendering. Switching modes remounts the row subtree and closes detail/column-manager state without changing the capped closed-history behavior.

* fix(connections): decouple collection from rendering

Move the high-frequency connection websocket path out of React Query and into a module-level external store consumed with useSyncExternalStore.

The store keeps one normalized active snapshot plus the capped closed history, continues collecting across route changes, and only notifies mounted subscribers. Home reads the same store through a lightweight summary snapshot, so leaving /connections no longer renders the table/list while connection history is still preserved.

This replaces the short-gc release behavior that made Active/Closed history disappear after navigating away, and bounds retained data to current active connections plus the closed cap instead of React Query cache objects.

* fix(connections): keep collection store authoritative

Remove the temporary per-subscription gcTime override added for /connections. The connection monitor now owns active/closed retention outside React Query, so route changes should stop rendering without clearing collected history.

This leaves the shared Mihomo websocket hook on its original 30s cache behavior for logs, traffic, and memory while /connections uses the external store introduced in the previous commit.

* perf(connections): coalesce snapshots before parsing

Keep only the latest raw websocket message during the 500ms throttle window and parse it when the store flushes. High-churn connection bursts no longer allocate parsed object graphs for snapshots that will be overwritten before React can observe them.

Also compare incoming metadata through the same normalization used for retained records, so optional undefined fields do not prevent metadata reference reuse.

* perf(connections): trim render allocations

Reuse existing row view objects before formatting derived strings when the retained connection object reference is unchanged. Stable closed-history rows no longer allocate throwaway display strings on every snapshot.

Measure the table scroll viewport on mount and resize instead of assuming a 1200px body, so virtual rendering starts from the real visible row count. Keep table state across Active/Closed switches and share the relative-time cell between table and list rows.

* perf(connections): tighten shared time updates

Refresh the shared relative-time clock before the first subscriber render and switch the listener registry back to a Set, avoiding stale labels after returning to /connections and keeping subscriber churn O(1).

Also sort table time rows by the existing numeric startTime field, drop the redundant row-view startTime equality check, and remove one unnecessary table prop guard.

* perf(connections): skip table-wide row projection

Stop materializing ConnectionRowView objects for the whole filtered dataset in table layout. The page now keeps raw connection records for the table path and only formats visible cells inside the virtualized table body, while list layout keeps the cached row-view path.

This removes the steady 500ms allocation pass that was still walking every filtered connection before table rendering. Detail lookup now reads the current filtered raw record directly, and the table clamps scroll state when switching between datasets of different lengths.

* perf(connections): skip unnecessary filter clone when table not searching

In table mode, avoid creating a filtered copy when search is empty: only apply search/sort work for non-empty query while retaining the same default order behavior. Also replace  parsing in order comparators with numeric startTime to avoid per-tick Date object churn and use SearchBox state to detect an empty search.

In table layout without search input, use upstream connection snapshot directly for rendering instead of cloning/sorting every interval tick. This removes a persistent per-update array allocation path while keeping list-mode sort/search behavior unchanged.

* perf(connections): bound closed merge without full transient arrays

Cap closed-history promotion while iterating previous active set without building a temporary large closed array. This preserves the 500-item limit while avoiding 100k-scale transient allocations when many connections close between snapshots.

* fix(changelog): address memory leak caused by frontend

* perf(connections): cache visible table cell snapshots

Add a bounded row snapshot cache for the virtualized table so repeated paints and optional column sorting reuse stable formatted strings instead of rebuilding host/source/rule/chains/traffic text on every refresh. The cache is capped to avoid retaining large active sets.

Also skip full connection-data snapshot merging when only summary listeners are mounted, keeping Home on the summary-only path without changing Connections history while the page is subscribed.

* chore: update Changelog

* chore: update Changelog
2026-06-07 13:08:15 +08:00
2026-03-15 07:40:11 +00:00
2022-11-12 11:37:23 +08:00
2026-04-21 23:50:59 +08:00
2026-03-15 07:40:11 +00:00
2021-12-22 01:12:32 +08:00
2026-05-26 14:34:40 +08:00
2026-05-24 13:14:59 +08:00

Clash
Continuation of Clash Verge

A Clash Meta GUI based on Tauri.

Languages: 简体中文 · English · Español · Русский · 日本語 · 한국어 · فارسی

Preview

Dark Light
预览 预览

Install

请到发布页面下载对应的安装包:Release page
Go to the Release page to download the corresponding installation package
Supports Windows (x64/x86), Linux (x64/arm64) and macOS 11+ (intel/apple).

我应当怎样选择发行版

版本 特征 链接
Stable 正式版,高可靠性,适合日常使用。 Release
Alpha(废弃) 测试发布流程。 Alpha
AutoBuild 滚动更新版,适合测试反馈,可能存在缺陷。 AutoBuild

安装说明和常见问题,请到 文档页 查看

TG 频道: @clash_verge_rev


Promotion

🤖 GPTKefu —— 与 Crisp 深度整合的 AI 智能客服平台

  • 🧠 深度理解完整对话上下文 + 图片识别,自动给出专业、精准的回复,告别机械式客服。
  • ♾️ 不限回答数量,无额度焦虑,区别于其他按条计费的 AI 客服产品。
  • 💬 售前咨询、售后服务、复杂问题解答,全场景轻松覆盖,真实用户案例已验证效果。
  • ⚡ 3 分钟极速接入,零门槛上手,即刻提升客服效率与客户满意度。
  • 🎁 高级套餐免费试用 14 天,先体验后付费:👉 立即试用
  • 📢 智能客服TG 频道:@crisp_ai

Features

  • 基于性能强劲的 Rust 和 Tauri 2 框架
  • 内置Clash.Meta(mihomo)内核,并支持切换 Alpha 版本内核。
  • 简洁美观的用户界面,支持自定义主题颜色、代理组/托盘图标以及 CSS Injection。
  • 配置文件管理和增强(Merge 和 Script),配置文件语法提示。
  • 系统代理和守卫、TUN(虚拟网卡) 模式。
  • 可视化节点和规则编辑
  • WebDav 配置备份和同步

FAQ

Refer to Doc FAQ Page

Donation

捐助Clash Verge Rev的开发

Development

See CONTRIBUTING.md for more details.

To run the development server, execute the following commands after all prerequisites for Tauri are installed:

pnpm i
pnpm run prebuild
pnpm dev

Contributions

Issue and PR welcome!

Acknowledgement

Clash Verge rev was based on or inspired by these projects and so on:

License

GPL-3.0 License. See License here for details.

S
Description
No description provided
Readme GPL-3.0
530 MiB
Languages
Rust 46.3%
TypeScript 45.3%
JavaScript 6%
NSIS 1.5%
Shell 0.5%
Other 0.3%