zhaohai666 opened a new pull request, #1676: URL: https://github.com/apache/rocketmq-dashboard/pull/1676
# PR: refactor(web): lazy-load login page, drop dead code and silence lint warnings **Branch:** `feature/studio-frontend-cleanup` **Commit:** `775b99db` — pushed to `origin/feature/studio-frontend-cleanup` **Base:** `apache:rocketmq-studio` @ `990ba092` **PR create link:** https://github.com/zhaohai666/rocketmq-dashboard/pull/new/feature/studio-frontend-cleanup ## Summary Frontend cleanup: the last eagerly-imported page is now lazy-loaded, the `chunkSizeWarningLimit` override is removed so oversized chunks warn again, dead code is deleted, and the frontend lint output is reduced to zero problems (0 errors / 0 warnings). ## Changes ### Lazy loading & bundle - **`web/src/App.tsx`**: `LoginPage` is now lazy-loaded like every other route (it was the only remaining eager page import), wrapped in its own `Suspense` fallback. - **`web/vite.config.ts`**: removed the `chunkSizeWarningLimit: 1400` override so the build warns again when a chunk grows (the antd vendor chunk is what triggers it — intentional visibility for future regressions). ### Dead code removal - `web/src/hooks/useApi.ts` — zero references. - `web/src/stores/clusterStore.ts` + `clusterStore.test.ts` — `fetchClusters` was written but never used in production. ### Lint (now 0 problems) - **`consumer.tsx`** — fixed the last two `react-hooks/set-state-in-effect` errors: - instance-scoped dialog resets via React's render-time adjustment pattern; - empty-instance list/loading resets in a microtask from the effect (preserves previous behavior). - **`BrokerCluster.tsx` / `GroupManagement.tsx` / `Proxy.tsx`** — fixed three `react-hooks/exhaustive-deps` warnings by copying the request-id ref value inside the effect and using it in the cleanup function. - **`LangContext.tsx` / `consumer.tsx`** — waived `react-refresh/only-export-components` where a context module / shared helper intentionally exports non-component members. ## Verification - `eslint .` — **0 problems** (previously 2 errors + 6 warnings). - `tsc -b` — clean. - Component tests — 44/44 (`ConsumerPage`, `BrokerCluster`, `GroupManagement`, `Proxy`). ## Notes - The large i18n migration (~2187 hard-coded Chinese strings) is intentionally out of scope for this PR and tracked separately. - No runtime behavior change other than the login page now loading on demand. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
