Skip to content

Commit 9268b9f

Browse files
fix agentic issues and apollo client
1 parent 3493b88 commit 9268b9f

File tree

8 files changed

+39
-64
lines changed

8 files changed

+39
-64
lines changed

bun.lockb

1.28 KB
Binary file not shown.

package.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"generate:graphql": "graphql-codegen --config codegen.ts"
1616
},
1717
"dependencies": {
18-
"@apollo/client": "^4.1.3",
18+
"@apollo/client": "^3.14.0",
1919
"@hookform/resolvers": "^5.2.2",
2020
"@radix-ui/react-dialog": "^1.1.15",
2121
"@radix-ui/react-dropdown-menu": "^2.1.16",
@@ -26,69 +26,68 @@
2626
"@radix-ui/react-slot": "^1.2.4",
2727
"@react-keycloak/web": "^3.4.0",
2828
"@reduxjs/toolkit": "^2.11.2",
29-
"@tanstack/react-table": "^8.20.6",
29+
"@tanstack/react-table": "^8.21.3",
3030
"class-variance-authority": "^0.7.1",
3131
"clsx": "^2.1.1",
32-
"cmdk": "^1.0.4",
33-
"graphql": "^16.12.0",
32+
"cmdk": "^1.1.1",
33+
"graphql": "^16.10.0",
3434
"graphql-codegen": "^0.4.0",
35-
"i18next": "^25.8.1",
36-
"i18next-browser-languagedetector": "^8.0.2",
37-
"keycloak-js": "^26.2.2",
38-
"lucide-react": "^0.563.0",
35+
"i18next": "^25.8.7",
36+
"i18next-browser-languagedetector": "^8.2.1",
37+
"keycloak-js": "^26.2.3",
38+
"lucide-react": "^0.564.0",
3939
"react": "^19.2.4",
4040
"react-dom": "^19.2.4",
4141
"react-hook-form": "^7.71.1",
4242
"react-i18next": "^16.5.4",
4343
"react-redux": "^9.2.0",
4444
"react-router-dom": "^7.13.0",
4545
"redux-persist": "^6.0.0",
46-
"tailwind-merge": "^3.4.0",
46+
"tailwind-merge": "^3.4.1",
4747
"tailwindcss-animate": "^1.0.7",
4848
"zod": "^4.3.6"
4949
},
5050
"engines": {
5151
"node": ">=22.12.0"
5252
},
5353
"devDependencies": {
54-
"@graphql-codegen/cli": "^6.1.1",
55-
"@graphql-codegen/client-preset": "^5.2.2",
56-
"@graphql-codegen/typescript-operations": "^5.0.7",
57-
"@graphql-codegen/typescript-react-apollo": "^4.4.0",
54+
"@graphql-codegen/cli": "^5.0.7",
55+
"@graphql-codegen/client-preset": "^4.8.3",
56+
"@graphql-codegen/typescript-operations": "^4.6.1",
57+
"@graphql-codegen/typescript-react-apollo": "^4.3.3",
5858
"@tailwindcss/postcss": "^4.1.18",
5959
"@tailwindcss/vite": "^4.1.18",
6060
"@testing-library/jest-dom": "^6.9.1",
6161
"@testing-library/react": "^16.3.2",
6262
"@testing-library/user-event": "^14.6.1",
6363
"@types/jest": "^30.0.0",
6464
"@types/keycloak-js": "^3.4.1",
65-
"@types/node": "^25.2.0",
66-
"@types/react": "^19.2.11",
67-
"@types/react-dom": "^19.2.3",
65+
"@types/node": "^25.2.3",
66+
"@types/react": "^19.2.14",
67+
"@types/react-dom": "^19.1.7",
6868
"@types/react-i18next": "^8.1.0",
6969
"@types/react-router-dom": "^5.3.3",
7070
"@types/redux-persist": "^4.3.1",
71-
"@typescript-eslint/eslint-plugin": "^8.54.0",
72-
"@typescript-eslint/parser": "^8.54.0",
71+
"@typescript-eslint/eslint-plugin": "^8.55.0",
72+
"@typescript-eslint/parser": "^8.55.0",
7373
"@vitejs/plugin-react-swc": "^4.2.3",
7474
"@vitest/coverage-v8": "^4.0.18",
7575
"@vitest/ui": "^4.0.18",
76-
"eslint": "^8.57.1",
76+
"eslint": "^9.39.2",
7777
"eslint-config-prettier": "^10.1.8",
7878
"eslint-plugin-import": "^2.32.0",
7979
"eslint-plugin-prettier": "^5.5.5",
8080
"eslint-plugin-react-hooks": "^7.0.1",
8181
"eslint-plugin-react-refresh": "^0.5.0",
82-
"happy-dom": "^20.6.1",
83-
"jsdom": "^28.0.0",
82+
"jsdom": "^28.1.0",
8483
"msw": "^2.12.8",
8584
"postcss": "^8.4.49",
8685
"prettier": "^3.8.1",
8786
"prettier-plugin-tailwindcss": "^0.7.2",
8887
"tailwindcss": "^4.1.18",
8988
"typescript": "^5.9.3",
9089
"vite": "^7.3.1",
91-
"vite-tsconfig-paths": "^6.0.5",
90+
"vite-tsconfig-paths": "^6.1.1",
9291
"vitest": "^4.0.18"
9392
}
9493
}

src/lib/keycloak.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Keycloak from 'keycloak-js'
44
// Pass initialization options as required or leave blank to load from 'keycloak.json'
55
const keycloak = new Keycloak({
66
url: import.meta.env.VITE_APP_KEYCLOAK_URL,
7-
realm: 'master',
7+
realm: 'app',
88
clientId: 'frontend',
99
})
1010

src/main.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client'
33
import { Provider } from 'react-redux'
44
import { persistor, store } from './store/store'
55
import { PersistGate } from 'redux-persist/integration/react'
6-
import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client'
6+
import { ApolloClient, ApolloProvider, createHttpLink, InMemoryCache } from '@apollo/client'
77
import { setContext } from '@apollo/client/link/context'
88
import { ReactKeycloakProvider } from '@react-keycloak/web'
99
import { AuthClientError, AuthClientEvent } from '@react-keycloak/core/lib/types'
@@ -15,7 +15,6 @@ import '@/locales/i18n'
1515
import './App.css'
1616

1717
import { ThemeProvider } from '@/components/theme-provider'
18-
import { ApolloProvider } from '@apollo/client/react'
1918

2019
const onKeycloakEvent = (_event: AuthClientEvent, error?: AuthClientError): void => {
2120
if (error) {

src/pages/users/Users.test.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,7 @@ import { usersApi } from './api/usersApi'
1010
import { Provider } from 'react-redux'
1111
import '@/locales/i18n'
1212
import { ThemeProvider } from '@/components/theme-provider'
13-
14-
// Mock the roles GraphQL hook to provide static role data
15-
vi.mock('./hooks/useRolesGraphql', () => ({
16-
useRolesGraphql: () => ({
17-
roles: [
18-
{
19-
_id: '63c16ce71ba30e5f08b4d66e',
20-
name: 'GUEST',
21-
description: 'Anonymous user who can only read info',
22-
version: undefined,
23-
createdBy: undefined,
24-
createdDate: undefined,
25-
modifiedBy: undefined,
26-
modifiedDate: undefined,
27-
},
28-
],
29-
loading: false,
30-
error: undefined,
31-
}),
32-
}))
33-
34-
import { MockedProvider } from '@apollo/client/testing/react'
13+
import { MockedProvider } from '@apollo/client/testing'
3514

3615
const mockedRolesGql = {
3716
request: {

src/pages/users/hooks/useColumns.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ export const useUserColumns = () => {
8484
updateUser(data).then(() => {})
8585
}}
8686
>
87-
<Label className="group m-0 inline-flex w-full rounded-md bg-background px-2 py-2 text-sm font-normal transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-hidden">
87+
<Label className="group bg-background hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground m-0 inline-flex w-full rounded-md px-2 py-2 text-sm font-normal transition-colors focus:outline-hidden">
8888
{t(`users.update`, { ns: ['main'] })}
8989
</Label>
9090
</UserDialog>
9191
<Label
92-
className="group m-0 inline-flex w-full rounded-md bg-background px-2 py-2 text-sm font-normal transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-hidden"
92+
className="group bg-background hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground m-0 inline-flex w-full rounded-md px-2 py-2 text-sm font-normal transition-colors focus:outline-hidden"
9393
onClick={() => deleteUser(user._id!)}
9494
>
9595
{t(`users.delete`, { ns: ['main'] })}

src/pages/users/hooks/useRolesGraphql.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { useEffect, useState, useCallback } from 'react'
2-
1+
import { useEffect, useState } from 'react'
32
import { Role } from '../api/usersApi.types'
43
import { useGetAllPermissionsQuery } from '@/graphql/generated'
54

@@ -14,26 +13,25 @@ export const useRolesGraphql = () => {
1413
},
1514
})
1615

17-
const getRoles = useCallback(() => {
18-
const permissions =
19-
data?.getAllPermissions?.map(
20-
(e: Role) =>
21-
({
22-
_id: e?._id,
23-
name: e?.name,
24-
}) as Role
25-
) ?? []
26-
setRoles(permissions)
27-
}, [data])
16+
const getRoles = () => {
17+
const permissions: Role[] | undefined = data?.getAllPermissions?.map((e) => {
18+
return {
19+
_id: e?.id,
20+
name: e?.name,
21+
} as Role
22+
})
23+
setRoles([...permissions!])
24+
}
2825

2926
useEffect(() => {
3027
if (!roles && !loading && !error && data) {
3128
getRoles()
3229
}
30+
3331
return () => {
3432
setRoles(undefined)
3533
}
36-
}, [roles, loading, error, data, getRoles])
34+
}, [data, loading, error])
3735

3836
return {
3937
roles,

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default defineConfig({
1313
// @ts-expect-error
1414
test: {
1515
globals: true,
16-
environment: 'happy-dom',
16+
environment: 'jsdom',
1717
css: true,
1818
setupFiles: [path.resolve(__dirname, './src/setupTests.ts')],
1919
},

0 commit comments

Comments
 (0)