mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6187] [MERGED] perf(frontend): blank Suspense → Spin loader, matchMedia resize hook, virtual table scrolling #6149
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6149
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6187
Author: @PathGao
Created: 8/8/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @MHSanaei
Base:
main← Head:perf/frontend-loading-virtual-scroll📝 Commits (3)
784c172perf(frontend): replace blank Suspense fallbacks with Spin, switch to matchMedia hook, add virtual table scrolling47eee26Merge branch 'main' into perf/frontend-loading-virtual-scroll3a733f2Merge branch 'main' into perf/frontend-loading-virtual-scroll📊 Changes
8 files changed (+42 additions, -20 deletions)
View changed files
📝
frontend/src/components/utility/LazyMount.tsx(+2 -1)📝
frontend/src/hooks/useMediaQuery.ts(+18 -6)📝
frontend/src/pages/clients/ClientsPage.tsx(+2 -1)📝
frontend/src/pages/hosts/HostList.tsx(+2 -1)📝
frontend/src/pages/inbounds/list/InboundList.tsx(+2 -1)📝
frontend/src/pages/nodes/NodeList.tsx(+2 -1)📝
frontend/src/pages/sub/SubPage.tsx(+2 -8)📝
frontend/src/routes.tsx(+12 -1)📄 Description
Summary
8 files, +42/−20 — all low-cost optimizations in the frontend layer.
Visual: blank Suspense fallback → centered
<Spin>routes.tsx+LazyMount.tsx— every route change and lazy modal used to render nothing (fallback={null}) while the code chunk loaded, showing a blank screen. Now shows a centered antd Spin loader, matching the established loading pattern already used in the codebase.Efficient:
useMediaQueryswitched fromresizetomatchMediauseMediaQuery.ts— the hook listened towindow.resizewhich fires on every pixel of window drag, triggering state updates and React re-renders in every component tree that calls it (most pages). Now uses the nativewindow.matchMedia("(max-width: Npx)").changeevent which fires only when the query actually flips. Also exportsMOBILE_BREAKPOINT_PX.SubPage.tsx— dropped a duplicate inlineisMobileimplementation (its ownuseState+resizelistener at a hardcoded 576px breakpoint) in favor of the shareduseMediaQuery(576)hook. Net −6 lines.Efficient: virtual scrolling on 4 large tables
ClientsPage.tsx,InboundList.tsx,HostList.tsx,NodeList.tsx— added antd Tablevirtualprop withscroll.y(viewport-relative calc). On large datasets, only the visible rows are rendered in the DOM. Tables withpagination={false}(HostList, NodeList) benefit most; paginated tables benefit at larger page sizes.calc(100vh - 380px)calc(100vh - 320px)calc(100vh - 280px)calc(100vh - 320px)Verification
Suspense/Spin/virtualare already used elsewhere in this codebase🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.