Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into feat/sentryTenderlyUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
agualis committed Sep 13, 2024
2 parents 66006f6 + 343b1ea commit de76f11
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 133 deletions.
6 changes: 6 additions & 0 deletions app/api/rpc/[chain]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ function getRpcUrl(chain: string) {
}

export async function POST(request: Request, { params: { chain } }: Params) {
if (!ALCHEMY_KEY) {
return new Response(JSON.stringify({ error: 'PRIVATE_ALCHEMY_KEY is missing' }), {
status: 500,
})
}

const rpcUrl = getRpcUrl(chain)
const rpcBody = await request.json()

Expand Down
23 changes: 9 additions & 14 deletions app/react-query.provider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use client'

import { isDev } from '@/lib/config/app.config'
import { captureError } from '@/lib/shared/utils/errors'
import { SentryMetadata, captureSentryError, shouldIgnore } from '@/lib/shared/utils/query-errors'
import { MutationCache, QueryCache, QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { ReactNode } from 'react'

export const queryClient = new QueryClient({
Expand Down Expand Up @@ -40,19 +42,12 @@ export const queryClient = new QueryClient({
}),
})

queryClient.setDefaultOptions({
queries: {
/* Avoids problems in simulation and build queries when the user navigates away from the page while waiting for a tx confirmation.
Without this option, navigating to another tab and coming back was causing useRemoveLiquidityBuildCallDataQuery to be undefined leading to unexpected thrown errors.
This is equivalent to setting the old keepPreviousData: true option
More info:
https://github.com/TanStack/query/discussions/6460
*/
placeholderData: (prev: any) => prev,
},
})

export function ReactQueryClientProvider({ children }: { children: ReactNode | ReactNode[] }) {
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
const shouldShowReactQueryDevtools = false
return (
<QueryClientProvider client={queryClient}>
{children}
{isDev && shouldShowReactQueryDevtools && <ReactQueryDevtools initialIsOpen={false} />}
</QueryClientProvider>
)
}
16 changes: 16 additions & 0 deletions lib/shared/utils/query-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,22 @@ export function shouldIgnore(message: string, stackTrace = ''): boolean {
return true
}

/*
Ignores issues with this kind of message:
The source https://balancer.fi/[URI] has not been authorized yet
We cannot reproduce but it looks like it does not crash the app.
First time seen in sentry: September 4th, 2024
https://vercel.com/balancer/frontend-v3/deployments?range={%22start%22:%222024-09-02T22:00:00.000Z%22,%22end%22:%222024-09-03T21:59:59.999Z%22}
Examples: https://balancer-labs.sentry.io/issues/5796181794
*/
if (message.startsWith('Error: The source') && message.includes('has not been authorized yet')) {
return true
}

return false
}

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@sentry/nextjs": "^8.13.0",
"@studio-freight/react-lenis": "^0.0.47",
"@tanstack/react-query": "^5.29.2",
"@tanstack/react-query-devtools": "^5.56.0",
"@tanstack/react-table": "^8.9.3",
"@vercel/speed-insights": "^1.0.1",
"bignumber.js": "^9.1.2",
Expand Down Expand Up @@ -83,9 +84,9 @@
"tinycolor2": "^1.6.0",
"use-debounce": "^10.0.0",
"use-sound": "^4.0.1",
"usehooks-ts": "^2.9.2",
"viem": "^2.19.3",
"wagmi": "^2.12.5"
"usehooks-ts": "^3.1.0",
"viem": "^2.21.6",
"wagmi": "^2.12.11"
},
"devDependencies": {
"@apollo/experimental-nextjs-app-support": "^0.8.0",
Expand Down
Loading

0 comments on commit de76f11

Please sign in to comment.