Frun1na opened a new issue, #6537:
URL: https://github.com/apache/rocketmq-dashboard/issues/6537

   ### Before Creating the Bug Report
   
   - [x] I have searched the [open 
issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository 
and believe that this is not a duplicate.
   - [x] This is a defect in RocketMQ Studio, not a usage question and not a 
defect in another Apache RocketMQ repository.
   - [x] I can reproduce this on the current `rocketmq-studio` branch, or I 
have stated the exact version I am running below.
   
   ### Studio Version
   
   branch: `rocketmq-studio`
   git commit id: `779b8c0e`
   deployed as: reproduced by a component test against that commit (the 
affected code is the web client)
   
   ### Runtime Environment
   
   OS: Ubuntu on WSL2
   MySQL: not applicable — the defect is in the web client's table sorting
   browser: not applicable — reproduced in a jsdom unit test (vitest + Testing 
Library)
   
   ### Connected RocketMQ Cluster
   
   RocketMQ version: not applicable — reproduced with a stubbed Lite topic list 
in a unit test
   access mode: not applicable
   deployment: not applicable
   
   ### Describe the Bug
   
   The Lite topic table's "Avg TTL" and "Last Active" columns rank a pattern 
the provider could not
   measure as if it were the smallest value, although the cells render `-` for 
those rows
   (`web/src/pages/studio/LiteTopic.tsx:466` and `:453`):
   
   ```tsx
         render: (val: number) => formatDuration(val),
         sorter: (a, b) => (a.averageTTL || 0) - (b.averageTTL || 0),
   ```
   
   The provider leaves both fields unset: 
`RocketMQLiteTopicProvider.buildSummary` sets
   `lastActiveTime` only after a session reported an access (a pattern with no 
connected consumer
   carries none), and `toMillis` returns null when the broker has no TTL 
attribute — the same situation
   whose TTL status the page already renders as unknown and offers as a filter 
value. `|| 0` turns that
   absence into a measured zero, so sorting either column ascending puts those 
patterns at the top, as
   if their TTL had expired first or as if they had been idle since 1970.
   
   ### Steps to Reproduce
   
   Reproduced by a component test rather than against a cluster:
   
   1. Render the page with two Lite topic patterns: one with 
`averageTTL`/`lastActiveTime` unset, one
      with a measurable TTL and last-active instant.
   2. Click the "平均 TTL" header (ascending).
   3. The unset pattern is listed first, before the measurable one.
   
   ### What Did You Expect to See?
   
   A value the column renders as `-` should not claim the first position of an 
ascending sort; it
   should stay out of the way in both directions, the way an unmeasured TPS is 
kept out of the
   comparison on the broker cluster page.
   
   ### What Did You See Instead?
   
   The unmeasured pattern sorts as the lowest TTL / the oldest activity and 
appears first.
   
   ### Additional Context
   
   - A fix with a regression test follows in a pull request.
   - The case is pinned by a unit test that fails without the fix:
     `AssertionError: expected 1 to be greater than 2` (the unmeasured row at 
index 1, the measurable one
     at index 2).
   
   ### Are You Willing to Submit a Pull Request?
   
   - [x] Yes, I am willing to submit a pull request.
   


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