This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new 46319f62 fix(cluster): retry client connection queries (#1709)
46319f62 is described below
commit 46319f62cb4d2a62292ebf05de69c7ee9aaea8d2
Author: aias00 <[email protected]>
AuthorDate: Tue Aug 11 20:51:51 2026 +0800
fix(cluster): retry client connection queries (#1709)
---
web/src/pages/cluster/__tests__/ClientsPage.test.tsx | 19 +++++++++++++++++++
web/src/pages/cluster/clients.tsx | 5 ++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
b/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
index 6972f021..c941aeda 100644
--- a/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
+++ b/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
@@ -222,6 +222,25 @@ describe('Clients page', () => {
expect(within(screen.getByTestId('connection-total')).getByText('0')).toBeInTheDocument();
});
+ it('retries the current instance connection query after a runtime failure',
async () => {
+ vi.mocked(connectionsService.listConnections)
+ .mockRejectedValueOnce(new Error('Client connection provider is not
configured'))
+ .mockResolvedValueOnce([connection]);
+ const user = userEvent.setup();
+ renderWithProviders(<ClientsPage />);
+
+ expect(
+ await screen.findByText('Client connection provider is not configured'),
+ ).toBeInTheDocument();
+ expect(connectionsService.listConnections).toHaveBeenCalledTimes(1);
+
+ await user.click(screen.getByRole('button', { name: /重\s*试/ }));
+
+ expect(await
screen.findByText('[email protected]:49152')).toBeInTheDocument();
+ expect(connectionsService.listConnections).toHaveBeenCalledTimes(2);
+ expect(connectionsService.listConnections).toHaveBeenLastCalledWith({
instanceId: 'instance-1' });
+ });
+
it('clears the previous instance data when the next instance connection
request fails', async () => {
vi.mocked(instanceService.listInstances).mockResolvedValue([
{
diff --git a/web/src/pages/cluster/clients.tsx
b/web/src/pages/cluster/clients.tsx
index 72cd0950..98c11a38 100644
--- a/web/src/pages/cluster/clients.tsx
+++ b/web/src/pages/cluster/clients.tsx
@@ -115,6 +115,7 @@ const ClientsPage = () => {
const [selectedConnection, setSelectedConnection] =
useState<ClientConnection | null>(null);
const [loadError, setLoadError] = useState<string | null>(null);
const [instanceLoadKey, setInstanceLoadKey] = useState(0);
+ const [connectionLoadKey, setConnectionLoadKey] = useState(0);
const handleInstanceChange = (instanceId: string) => {
setSelectedInstanceId(instanceId);
@@ -181,7 +182,7 @@ const ClientsPage = () => {
return () => {
cancelled = true;
};
- }, [selectedInstanceId]);
+ }, [connectionLoadKey, selectedInstanceId]);
/* ─── Cluster options using nsClusterName ─── */
const clusterOptions = useMemo(() => {
@@ -392,7 +393,9 @@ const ClientsPage = () => {
size="small"
onClick={() => {
setLoading(true);
+ setLoadError(null);
setInstanceLoadKey((key) => key + 1);
+ setConnectionLoadKey((key) => key + 1);
}}
>
重试