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

   Fixes #6868
   
   ## The regression
   
   The 验证 tab rendered `1970-01-01 08:00:00.000` for a consumption that never 
happened, and the trace step line the same for a node without a timestamp. Both 
endpoints use `0` for "no time" — `docs/api-spec.md:1610` defines `consumeTime` 
that way, and `RocketMQMessageProvider.buildConsumerStatus` parses the optional 
8th SubAfter column, so a record without it yields `0`.
   
   The page used to handle that: the formatter it owned began with `if (!value) 
return '-'`, the guard #2094 added for #2081. #4829 replaced it with the shared 
`formatTimeMs`, which renders `0` as the epoch on purpose (pinned by 
`format.test.ts`), and the call site's own check only knows the string `'-'` 
that the demo fixture sends. Nothing pinned the call site, so the fix was lost 
silently.
   
   ## The fix
   
   `formatOptionalEpoch` in `message.tsx` — used by the consumer-status cell 
and the trace step line — treats `0` (and an unparsable value) as absent and 
delegates everything else to `formatTimeMs`. The shared formatter is untouched, 
so a stored timestamp at epoch 0 still renders as an epoch.
   
   ## Tests
   
   Red before the change:
   
   ```
   FAIL > renders a consumption with no recorded time as the placeholder 
instead of the Unix epoch
   expect(within(statusRow).getAllByRole('cell')[2]).toHaveTextContent('-')
     1970-01-01 08:00:00.000
   ```
   
   Green after:
   
   ```
   Test Files  2 passed (2)     Tests  53 passed (53)    (MessagePage.test.tsx 
+ MessagePageAsyncState.test.tsx)
   tsc -b            exit 0
   eslint            exit 0
   prettier --check  All matched files use Prettier code style!
   ```
   


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