Replace mocked benchmarkApi.createBenchmark with real API call#2044
Replace mocked benchmarkApi.createBenchmark with real API call#2044
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces the mocked benchmark creation behavior with a real backend API call and attempts to refresh relevant cached data after a benchmark is created (OPS-3822).
Changes:
- Replace
benchmarkApi.createBenchmarkmock implementation with a realPOST /v1/benchmarks/:providerrequest. - Invalidate React Query caches after successful benchmark creation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/react-ui/src/app/features/benchmark/benchmark-api.ts |
Removes the mocked createBenchmark and calls the real API endpoint. |
packages/react-ui/src/app/features/benchmark/use-benchmark-wizard-navigation.ts |
Adds React Query cache invalidation after benchmark creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-ui/src/app/features/benchmark/use-benchmark-wizard-navigation.ts
Show resolved
Hide resolved
| queryKey: [QueryKeys.foldersFlows, QueryKeys.flows], | ||
| }); |
There was a problem hiding this comment.
invalidateQueries is being called with queryKey: [QueryKeys.foldersFlows, QueryKeys.flows], which will only match queries whose key starts with that two-element prefix. In this codebase, folder tree uses [QueryKeys.foldersFlows] and flows list uses [QueryKeys.flows, ...], so this call likely won't invalidate anything. Invalidate each key separately (or use the existing useRefetchFolderTree helper for folders, and a separate invalidation for [QueryKeys.flows]).
| queryKey: [QueryKeys.foldersFlows, QueryKeys.flows], | |
| }); | |
| queryKey: [QueryKeys.foldersFlows], | |
| }); | |
| queryClient.invalidateQueries({ | |
| queryKey: [QueryKeys.flows], | |
| }); |
|



Fixes OPS-3822.
https://www.loom.com/share/a94a43e7998b481a9074c19c8d92d786