Skip to content

Commit 01c94aa

Browse files
committed
Fix new credential not being selected on creating
1 parent a76590f commit 01c94aa

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

packages/agentflow/src/infrastructure/api/credentials.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { AxiosInstance } from 'axios'
2-
31
import { bindCredentialsApi } from './credentials'
2+
import type { DeduplicatedClient } from './deduplicatedClient'
43

54
const mockClient = {
65
get: jest.fn(),
76
post: jest.fn(),
8-
put: jest.fn()
9-
} as unknown as jest.Mocked<AxiosInstance>
7+
put: jest.fn(),
8+
clearCache: jest.fn()
9+
} as unknown as jest.Mocked<DeduplicatedClient>
1010

1111
beforeEach(() => {
1212
jest.clearAllMocks()

packages/agentflow/src/infrastructure/api/credentials.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { AxiosInstance } from 'axios'
2-
31
import type { ComponentCredentialSchema, CreateCredentialBody, Credential } from '@/core/types'
42

3+
import type { DeduplicatedClient } from './deduplicatedClient'
4+
55
/**
66
* Create credentials API functions bound to a client instance
77
*/
8-
export function bindCredentialsApi(client: AxiosInstance) {
8+
export function bindCredentialsApi(client: DeduplicatedClient) {
99
return {
1010
/**
1111
* Get all credentials
@@ -36,6 +36,7 @@ export function bindCredentialsApi(client: AxiosInstance) {
3636
*/
3737
createCredential: async (body: CreateCredentialBody): Promise<Credential> => {
3838
const response = await client.post('/credentials', body)
39+
client.clearCache()
3940
return response.data
4041
},
4142

@@ -52,6 +53,7 @@ export function bindCredentialsApi(client: AxiosInstance) {
5253
*/
5354
updateCredential: async (id: string, body: CreateCredentialBody): Promise<Credential> => {
5455
const response = await client.put(`/credentials/${id}`, body)
56+
client.clearCache()
5557
return response.data
5658
}
5759
}

packages/agentflow/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default defineConfig(({ mode }) => {
4646
'react/jsx-runtime': 'jsxRuntime',
4747
'@mui/material': 'MaterialUI',
4848
'@mui/material/styles': 'MaterialUIStyles',
49+
'@mui/icons-material': 'MaterialUIIcons',
4950
'@emotion/react': 'emotionReact',
5051
'@emotion/styled': 'emotionStyled',
5152
reactflow: 'ReactFlow'

0 commit comments

Comments
 (0)