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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #7133
   
   ### Brief Description
   
   Opening or creating an AI conversation changes the URL from `/ai` to 
`/ai/c/<id>`, but the sidebar selects the full pathname even though its AI 
entry has only the `/ai` key. The selected state disappears while the operator 
is still on the AI page.
   
   Use React Router's complete-path matching for the two registered AI routes 
and normalize their selected menu key to `/ai`. Reuse that classification for 
the existing AI Content overflow declaration. Trailing slashes are accepted 
consistently with the router; unrelated prefixes and extra path segments do not 
select AI.
   
   Add ten regressions using the real MainLayout, Antd Menu, and router. They 
cover direct entry, trailing slashes, unrelated paths, conversation navigation, 
and leaving AI for Settings. The style assertions check the existing 
declaration only; no browser scrolling defect or visual viewport coverage is 
claimed.
   
   All-state issue/PR searches and the nearby #4606, #5025, and #5338 
MainLayout changes were checked for overlap. AI assistance was used for 
investigation, implementation, and regression testing.
   
   ### How Did You Test This Change?
   
   Baseline: `rocketmq-studio@127c47b06a268cc74224d5f34c56ec7c36ac0d55`.
   
   With the final new tests and unchanged production, the focused test file 
fails four cases: `/ai/`, `/ai/c/7`, `/ai/c/7/`, and the in-place conversation 
navigation. Each expects the selected menu class but receives an unselected 
item. Six controls pass.
   
   After the fix, from `web/`:
   
   ```sh
   node_modules/.bin/vitest run src/layouts/MainLayout.aiNavigation.test.tsx 
src/layouts/MainLayout.test.tsx src/layouts/MainLayout.navigation.test.tsx 
--pool=threads --maxWorkers=1
   # 3 files, 20 tests passed (16.28 seconds)
   node_modules/.bin/tsc -b --force
   node_modules/.bin/eslint src/layouts/MainLayout.tsx 
src/layouts/MainLayout.aiNavigation.test.tsx
   node_modules/.bin/prettier --check src/layouts/MainLayout.tsx 
src/layouts/MainLayout.aiNavigation.test.tsx
   git diff --check
   # All exit 0.
   ```
   
   The existing real navigation-search tests emit jsdom's pseudo-element 
`getComputedStyle` notices; there are no test failures. Full frontend, backend, 
and browser viewport suites were not run for this focused route-classification 
change.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Conventional Commit subject
   - [x] Regression tests added, with `...Test` names
   - [x] New source file carries the ASF license header
   - [x] No new UI text or translation keys
   - [x] No architecture or API changes; backend suite not run
   - [x] No documentation change needed for restoration of existing navigation 
behavior
   


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