Fix xray query

This commit is contained in:
BrunoQuaresma 2024-04-23 11:50:57 +00:00
parent e04ebb6810
commit 495fe25a76
2 changed files with 8 additions and 4 deletions

View File

@ -1,9 +1,14 @@
import type { GetJFrogXRayScanParams } from "api/api";
import * as API from "api/api";
import type { WorkspaceAgentStatus } from "api/typesGenerated";
export const xrayScan = (params: GetJFrogXRayScanParams) => {
export const xrayScan = (
params: GetJFrogXRayScanParams,
status: WorkspaceAgentStatus,
) => {
return {
queryKey: ["xray", params],
// Reload the xray results whenever the status changes
queryKey: ["xray", params, status],
queryFn: () => API.getJFrogXRayScan(params),
};
};

View File

@ -72,8 +72,7 @@ export const AgentRow: FC<AgentRowProps> = ({
}) => {
// XRay integration
const xrayScanQuery = useQuery(
[agent.status],
xrayScan({ workspaceId: workspace.id, agentId: agent.id }),
xrayScan({ workspaceId: workspace.id, agentId: agent.id }, agent.status),
);
// Apps visibility