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

   ### Which Issue(s) This PR Fixes
   
   The matching bug report will be linked immediately after publication.
   
   ### Brief Description
   
   On the bare `/ai` page, send prompt A while conversation creation is 
pending, then type unsent draft B. If creation fails, the old callback restores 
A over B. Applying a template or deliberately clearing a newly typed draft has 
the same problem.
   
   Track draft revisions in `useComposerDraft` and capture a restore callback 
when sending. Restore the submitted prompt only if no later draft write 
occurred. Composer clears its submitted value before notifying `onSend`, so 
that clear is part of the captured version. The existing unedited failure still 
restores A. Home's shared Composer continues to submit the supplied text.
   
   This concerns newer edits on the same mounted page. #4739/#4740 addresses 
refused existing-conversation sends, #5454 addresses duplicate creation, and 
#5787 addresses navigation during creation; their admission/route handling is 
not changed here.
   
   ### How Did You Test This Change?
   
   Base: `rocketmq-studio` at `779b8c0e7aed2396d3cc72743dcd544ea48e9ae6`. Node 
24.15.0, npm 11.12.1.
   
   - Same real AiPage/Composer tests on old production: **3 failures, 1 passing 
control**. Typed text, deliberate clearing and an applied built-in template 
were replaced by A; without a later edit A was correctly restored.
   - Repaired focused cases: **4/4 passed**, checking visible textarea, draft 
storage, unchanged route and no opened stream.
   - `npm test -- --maxWorkers=1 src/pages/ai/__tests__/AiPage.test.tsx 
src/pages/ai/components/__tests__/Composer.test.tsx 
src/pages/home/__tests__/HomePage.test.tsx`: **3 files, 52/52 passed**.
   - `npm run lint`: **0 errors, 10 warnings in unchanged files**.
   - `npm run build`: TypeScript, production bundle and license gate passed 
(**133 components / 140 license files**).
   - Changed-file Prettier and `git diff --check` passed. Independent review 
checked the complete diff, real red/green evidence and both Composer callers.
   
   Conversation creation is deferred/rejected at the ordinary frontend API 
boundary in the existing component harness. No full frontend, Java/Go, live 
model/broker/database or deployment test was run; no remote CI success is 
claimed. AI assistance (Codex) was used for investigation, implementation, 
testing and independent review.
   
   ### Checklist
   
   - [x] One coherent change and Conventional Commit subject
   - [x] Real component regressions and compatibility control, named `...Test`
   - [x] Existing ASF headers retained; no new source files or UI wording
   - [ ] Backend architecture/integration tests: not run (no backend change)
   


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