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

   ## Summary
   - `api/metadata.importTopics` and `api/metadata.importConsumerGroups` 
normalize their result: a success envelope with `data: null` or a partial 
result now resolves to zeroed counters and empty `topics`/`groups`/`failures` 
arrays
   - `api/producer.fetchTopicList` tolerates a non-array topic-list payload and 
drops non-string entries before sorting
   - `opsService.cleanupAuditLogs` treats a null API result as zero deleted 
records
   - Adds regression tests for every case (null payloads, missing arrays, 
non-array topic lists, plus happy paths)
   
   ## Why
   The client interceptor validates the business `code`, but a `code: 0` 
envelope can still carry `data: null` or a result object with missing fields. 
The import endpoints returned `res.data.data` verbatim, so the import UI's 
`result.topics.map(...)` / `result.groups.map(...)` crashed on a null or 
partial payload. `fetchTopicList` fell back to `topicList` and called `.sort()` 
unconditionally — a string payload threw `topics.sort is not a function`. 
`cleanupAuditLogs` read `result.deleted` off an unguarded response.
   
   ## Testing
   - `./node_modules/.bin/vitest run src/api/metadata.test.ts 
src/api/producer.test.ts src/services/opsService.cleanup.test.ts` → 24 passed 
(8 new; verified 7 fail with the pre-fix code, the remaining one is the 
happy-path check that passes both before and after)
   - `./node_modules/.bin/tsc --noEmit` → clean
   - `./node_modules/.bin/eslint` on the 6 changed files → 0 errors
   


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