Copilot commented on code in PR #893:
URL:
https://github.com/apache/rocketmq-dashboard/pull/893#discussion_r3708547856
##########
web/src/pages/instance/index.tsx:
##########
@@ -327,7 +331,7 @@ const InstancePage = () => {
size="small"
onRow={(record) => ({
style: { cursor: 'pointer' },
- onClick: () => message.info(`进入 ${record.name}`),
+ onClick: () =>
navigate(`/instance/topic?instanceId=${encodeURIComponent(record.id)}`),
})}
Review Comment:
The navigation adds an `instanceId` query param, but the Topic page doesn’t
appear to read `instanceId` anywhere in the web app (no `instanceId` usage
found outside this file/test). As-is, this likely won’t actually scope the
Topic view by instance and can mislead future readers/tests.
##########
web/src/pages/instance/__tests__/InstancePage.test.tsx:
##########
@@ -185,4 +206,26 @@ describe('InstancePage', () => {
);
expect(instanceService.listInstances).toHaveBeenLastCalledWith({ type:
'DIRECT' });
});
+
+ it('navigates to the topic view with the selected instance id when a row is
clicked', async () => {
+ const user = userEvent.setup();
+ renderPage();
+
+ await user.click(await screen.findByText('production-proxy'));
+
+ expect(await screen.findByText('Topic route')).toBeInTheDocument();
+ expect(currentLocation).toBe('/instance/topic?instanceId=proxy-1');
+ });
Review Comment:
`currentLocation` is updated via a `useEffect`, so asserting it
synchronously after `findByText` can be timing-sensitive and flaky (effects run
after commit). Prefer waiting for the probe to update before asserting the
final URL.
This issue also appears on line 227 of the same file.
--
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]