zhaohai666 opened a new pull request, #1981:
URL: https://github.com/apache/rocketmq-dashboard/pull/1981

   # PR: refactor(web): fix lint errors, stop refetching the instance list on 
selection change, confirm history clear
   
   **Branch:** `feature/studio-web-fixes`
   **Commit:** `372febfa` — pushed to `origin/feature/studio-web-fixes`
   **Base:** `apache:rocketmq-studio` @ `103555a7`
   **PR create link:** 
https://github.com/zhaohai666/rocketmq-dashboard/pull/new/feature/studio-web-fixes
   
   ## Summary
   
   Frontend fixes from the 2026-08-12 code review 
(`docs/code-review-2026-08-12.md`):
   frontend lint is now clean (was 1 error + 2 warnings), switching instances no
   longer re-fetches the full instance list, clearing the message query history
   requires confirmation, and the deprecated antd `bodyStyle` prop is migrated.
   
   ## Changes
   
   ### Lint — 0 problems (was 1 error + 2 warnings)
   
   - **`src/pages/studio/BrokerCluster.tsx`** — the mount effect no longer calls
     `loadData()` synchronously inside the effect body
     (`react-hooks/set-state-in-effect`); it now runs in a microtask, and the
     request-id ref value is copied into the effect and used by the cleanup
     (`react-hooks/exhaustive-deps`).
   - **`src/layouts/MainLayout.tsx`** — `pathSnippets` is memoized and added to 
the
     breadcrumb `useMemo` dependency array (fixes the missing-dependency 
warning and
     keeps the memo actually stable across unrelated re-renders).
   
   ### Perf — instance list no longer refetched on selection change
   
   - **`src/hooks/useInstanceFilter.ts`** — the list effect previously depended 
on
     `routeInstanceId`, so every instance switch re-queried the full instance 
list
     in all 7 instance pages even though the list is independent of the 
selection.
     The latest route id is now tracked in a ref; the list is fetched on
     section/navigation changes only, while the redirect-to-first-instance logic
     still reads the current selection from the ref.
   
   ### UX — confirm destructive action
   
   - **`src/pages/instance/message.tsx`** — the "清空历史" (clear query history) 
menu
     item now shows a confirmation dialog (`Modal.confirm`, danger) before 
clearing
     the in-memory history and `localStorage`, instead of acting immediately.
   
   ### Deprecations — antd `bodyStyle` → `styles.body`
   
   - Replaced the deprecated `Card bodyStyle` prop with `styles={{ body: ... 
}}` in
     12 places across 9 files: `cluster/index.tsx` (3), `cluster/certs.tsx`,
     `cluster/clients.tsx`, `instance/index.tsx`, `instance/consumer.tsx` (2),
     `instance/acl.tsx`, `instance/message.tsx`, `instance/dlq.tsx`,
     `ops/alerts.tsx`.
   
   ## Verification
   
   - `eslint .` — **0 problems**.
   - `tsc -b` — clean.
   - Full frontend suite — **532/532 tests, 92 files, all green** (BrokerCluster
     13, useInstanceFilter 15, MessagePage 14, plus cluster/instance/ops pages).
   - `MessagePage.test.tsx` updated: the clear-history test now drives
     `Modal.confirm`'s `onOk` through a spy instead of relying on portal 
rendering
     in jsdom.
   
   ## Notes
   
   - No behavior change besides: instance-list fetch frequency, the confirmation
     on clearing history, and equivalent style props on Card.
   - The larger frontend items from the review (i18n migration ~840 hard-coded
     strings, cancelled-boilerplate unification, api/services layer split) are
     intentionally out of scope and tracked separately.
   


-- 
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]

Reply via email to