Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tests #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/frontend-v3/lib/modules/pool/PoolProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
GqlChain,
} from '@/lib/shared/services/api/generated/graphql'
import { createContext, PropsWithChildren, useRef } from 'react'
import { useQuery } from '@apollo/experimental-nextjs-app-support/ssr'
import { useQuery } from '@apollo/client'
import { FetchPoolProps } from './pool.types'
import { useMandatoryContext } from '@/lib/shared/utils/contexts'
import { calcBptPriceFor, usePoolHelpers } from './pool.helpers'
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend-v3/lib/modules/pool/usePoolEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
GetPoolEventsQuery,
} from '@/lib/shared/services/api/generated/graphql'
import { FetchPolicy } from '@apollo/client'
import { useQuery } from '@apollo/experimental-nextjs-app-support/ssr'
import { useQuery } from '@apollo/client'

type PoolEventList = GetPoolEventsQuery['poolEvents']
export type PoolEventItem = PoolEventList[0]
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend-v3/lib/shared/hooks/useProtocolStats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useQuery } from '@apollo/experimental-nextjs-app-support/ssr'
import { useQuery } from '@apollo/client'
import { GetProtocolStatsDocument } from '../services/api/generated/graphql'
import { supportedNetworks } from '@/lib/modules/web3/ChainConfig'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

// eslint-disable-next-line max-len
import { ApolloNextAppProvider } from '@apollo/experimental-nextjs-app-support/ssr'
import { ApolloNextAppProvider } from '@apollo/experimental-nextjs-app-support'
import { createApolloClient } from '@/lib/shared/services/api/apollo.client'

export function ApolloClientProvider({ children }: React.PropsWithChildren) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { config } from '@/lib/config/app.config'
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
import { registerApolloClient } from '@apollo/experimental-nextjs-app-support/rsc'
import { registerApolloClient } from '@apollo/experimental-nextjs-app-support'

export const { getClient: getApolloServerClient } = registerApolloClient(() => {
return new ApolloClient({
Expand Down
10 changes: 5 additions & 5 deletions apps/frontend-v3/lib/shared/services/api/apollo.client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { config } from '@/lib/config/app.config'
import { ApolloLink, HttpLink } from '@apollo/client'
import {
NextSSRApolloClient,
NextSSRInMemoryCache,
ApolloClient,
InMemoryCache,
SSRMultipartLink,
} from '@apollo/experimental-nextjs-app-support/ssr'
} from '@apollo/experimental-nextjs-app-support'

/*const userMiddleware = new ApolloLink((operation, forward) => {
// add the user address to the headers
Expand All @@ -25,7 +25,7 @@ export function createApolloClient() {
//const keyArgs = ['where', ['poolIdIn']]
const httpLink = new HttpLink({ uri: config.apiUrl })

return new NextSSRApolloClient({
return new ApolloClient({
ssrMode: typeof window === 'undefined',
link:
typeof window === 'undefined'
Expand All @@ -36,7 +36,7 @@ export function createApolloClient() {
httpLink,
])
: httpLink,
cache: new NextSSRInMemoryCache({
cache: new InMemoryCache({
typePolicies: {
GqlToken: {
keyFields: ['address', 'chainId'],
Expand Down
12 changes: 6 additions & 6 deletions apps/frontend-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"postinstall": "npm run gen:theme-typings"
},
"dependencies": {
"@apollo/client": "3.8.0-rc.1",
"@apollo/client": "3.11.8",
"@balancer/sdk": "^0.25.0",
"@chakra-ui/anatomy": "^2.2.2",
"@chakra-ui/hooks": "^2.2.1",
Expand All @@ -43,10 +43,10 @@
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@nikolovlazar/chakra-ui-prose": "^1.2.1",
"@rainbow-me/rainbowkit": "^2.1.3",
"@rainbow-me/rainbowkit": "^2.1.6",
"@sentry/nextjs": "^8.13.0",
"@studio-freight/react-lenis": "^0.0.47",
"@tanstack/react-query": "^5.29.2",
"@tanstack/react-query": "^5.56.2",
"@tanstack/react-query-devtools": "^5.56.0",
"@tanstack/react-table": "^8.9.3",
"@vercel/speed-insights": "^1.0.1",
Expand Down Expand Up @@ -88,7 +88,7 @@
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@apollo/experimental-nextjs-app-support": "^0.8.0",
"@apollo/experimental-nextjs-app-support": "^0.11.3",
"@chakra-ui/cli": "^2.4.1",
"@chakra-ui/styled-system": "^2.9.2",
"@graphql-codegen/cli": "^5.0.0",
Expand Down Expand Up @@ -133,8 +133,8 @@
"stylelint-config-standard": "^33.0.0",
"stylelint-prettier": "^3.0.0",
"typescript": "5.4.5",
"vitest": "1.4.0",
"vitest-mock-extended": "^1.3.1"
"vitest": "^2.1.1",
"vitest-mock-extended": "^2.0.2"
},
"engineStrict": true,
"engines": {
Expand Down
12 changes: 12 additions & 0 deletions apps/frontend-v3/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,17 @@ export default defineConfig({
setupFiles: ['test/vitest/setup-vitest.tsx', 'test/vitest/setup-msw.ts'],
// disable if parsing CSS is slow
css: true,
server: {
deps: {
/*
Some dependencies like next-usequerystate ship code in ESM format.
We need this inline option to ensure that they are correctly transformed.
More info:
https://vitest.dev/config/#server-deps-inline
https://github.com/vitest-dev/vitest/issues/4745
*/
inline: ['next-usequerystate'],
},
},
},
})
15 changes: 8 additions & 7 deletions packages/eslint-config/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ module.exports = {
group: ['wagmi/dist'],
message: 'Invalid import: remove dist from import path',
},
{
group: ['@apollo/client'],
importNames: ['useQuery'],
message:
// eslint-disable-next-line max-len
'Import useQuery from @apollo/experimental-nextjs-app-support/ssr to avoid u.inFlightLinkObservables errors',
},
// TODO: delete once we confirm that u.inFlightLinkObservables error does not happen when importing from @apollo/client after migrating to its latest version
// {
// group: ['@apollo/client'],
// importNames: ['useQuery'],
// message:
// // eslint-disable-next-line max-len
// 'Import useQuery from @apollo/experimental-nextjs-app-support/ssr to avoid u.inFlightLinkObservables errors',
// },
{
group: ['act'],
importNames: ['react-dom/test-utils'],
Expand Down
Loading
Loading