chstercc opened a new pull request, #6377: URL: https://github.com/apache/rocketmq-dashboard/pull/6377
### Which Issue(s) This PR Fixes - Fixes #6359 ### Brief Description A slow earlier metrics query could jump ahead of newer queries when it completed, and the 12-entry history cap could permanently discard a newer query. Reopening the explorer then showed a different order because persisted history was sorted by query time. Sort merged history by descending queriedAt, retain the newest occurrence of each existing query identity, then apply the limit. Stable equal-time ordering keeps incoming entries first and preserves the relative order of existing entries. Add five unit regressions for chronology, input immutability, bounded retention, late duplicates, equal-time persistence, and custom limits. Add one real MetricsExplorer regression that holds a profile response open, completes a newer custom query, then verifies the visible and persisted history after the older response completes. AI assistance was used for investigation, implementation and validation; the final diff was reviewed. ### How Did You Test This Change? Using Linux Node.js 22.20.0 and locked dependencies against upstream rocketmq-studio@779b8c0e7aed2396d3cc72743dcd544ea48e9ae6: - Before the fix, focused tests reported 5 new regression failures and 50 passes (including the equal-time control). - `cd web && npm test -- src/utils/metricsExplorerDiagnostics.test.ts src/components/__tests__/MetricsExplorer.test.tsx`: 2 files, 55 tests passed. - `cd web && npm test`: 159 files, 1610 tests passed. - `cd web && npm run lint`: passed, 0 errors and 10 existing warnings in unchanged files. - `cd web && npm run build`: passed, including TypeScript, Vite and the final license gate (133 actual components, 140 license files). - Prettier checks passed for the component test and the added utility/test blocks using the repository configuration. Pre-existing utility formatting was retained to avoid unrelated changes. - `git diff --check`: passed. Backend/ArchUnit and live browser or broker integration tests were not run. The component test uses the actual explorer and controlled metrics API responses. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits - [x] Tests added for non-trivial changes, new test names end in Test - [x] New UI text has both Chinese and English entries — no new UI text - [ ] Architecture constraints stay green — backend tests not run, frontend-only change - [x] New source files carry the ASF license header — no new files, existing headers retained - [ ] Documentation touched where behaviour changed — no documentation changes -- 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]
