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

   ## Which Issue(s) This PR Fixes
   
   Fixes #
   
   ## Brief Description
   
   Restoring a query-history entry whose data source requires authentication 
switched the data source selector and cleared the stored credentials *before* 
showing the credential dialog. If the user cancels the dialog, the explorer is 
left stranded on the protected source with no credentials and no data, even 
though the restore was never confirmed.
   
   This PR defers the data source switch to the submit handler of the auth 
dialog:
   
   - Cancelling the dialog now leaves the explorer exactly where it was — the 
previous source stays selected and keeps its credentials.
   - Confirming still switches to the restored source, applies the replayed 
profile/range/query and fires the query, same as before.
   - Also added a regression test that cancels the dialog and asserts the 
selector still shows the previous source.
   
   ## How Did You Test This Change?
   
   ```
   cd web
   npx vitest run src/components/__tests__/MetricsExplorer.test.tsx
   ```
   
   ```
   Test Files  1 passed (1)
         Tests  28 passed (28)
   ```
   
   The new test fails on the unfixed code (the selector still shows the 
protected source after cancelling) and passes with this fix.
   
   ```
   npx tsc --noEmit
   npx eslint src/components/MetricsExplorer.tsx 
src/components/__tests__/MetricsExplorer.test.tsx
   ```
   
   Both clean.
   
   Note: open PR #4570 also touches `MetricsExplorer.tsx` but for a different 
purpose (history panel behavior); rebase may need a small adjustment, no intent 
overlap.
   
   ## Checklist
   
   - [x] Follows the project's code style
   - [x] Tests pass locally
   - [x] No new warnings
   


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