uniswap-interface-uncensored/src/index.tsx
Mike Grabowski 0e9b05405d
feat: add Sentry / improve error handling (#5509)
* initial commit

* chore: tweaks

* chore: tweaks ahead of full rewrite

* chore: only enable Sentry in production builds

* chore: keep existing behavior

* chore: fix lint

* chore: add release

* feat: remove GA sendEvent exception

* chore: simplify

* chore: bring back new line

* chore: group code together
2022-12-05 15:37:37 +04:00

90 lines
2.8 KiB
TypeScript

import '@reach/dialog/styles.css'
import 'inter-ui'
import 'polyfills'
import 'components/analytics'
import * as Sentry from '@sentry/react'
import { FeatureFlagsProvider } from 'featureFlags'
import RelayEnvironment from 'graphql/data/RelayEnvironment'
import { BlockNumberProvider } from 'lib/hooks/useBlockNumber'
import { MulticallUpdater } from 'lib/state/multicall'
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { QueryClient, QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux'
import { RelayEnvironmentProvider } from 'react-relay'
import { HashRouter } from 'react-router-dom'
import { isProductionEnv } from 'utils/env'
import Web3Provider from './components/Web3Provider'
import { LanguageProvider } from './i18n'
import App from './pages/App'
import * as serviceWorkerRegistration from './serviceWorkerRegistration'
import store from './state'
import ApplicationUpdater from './state/application/updater'
import ListsUpdater from './state/lists/updater'
import LogsUpdater from './state/logs/updater'
import TransactionUpdater from './state/transactions/updater'
import UserUpdater from './state/user/updater'
import ThemeProvider, { ThemedGlobalStyle } from './theme'
import RadialGradientByChainUpdater from './theme/components/RadialGradientByChainUpdater'
if (!!window.ethereum) {
window.ethereum.autoRefreshOnNetworkChange = false
}
if (isProductionEnv()) {
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
release: process.env.REACT_APP_GIT_COMMIT_HASH,
})
}
function Updaters() {
return (
<>
<RadialGradientByChainUpdater />
<ListsUpdater />
<UserUpdater />
<ApplicationUpdater />
<TransactionUpdater />
<MulticallUpdater />
<LogsUpdater />
</>
)
}
const queryClient = new QueryClient()
const container = document.getElementById('root') as HTMLElement
createRoot(container).render(
<StrictMode>
<Provider store={store}>
<FeatureFlagsProvider>
<QueryClientProvider client={queryClient}>
<HashRouter>
<LanguageProvider>
<Web3Provider>
<RelayEnvironmentProvider environment={RelayEnvironment}>
<BlockNumberProvider>
<Updaters />
<ThemeProvider>
<ThemedGlobalStyle />
<App />
</ThemeProvider>
</BlockNumberProvider>
</RelayEnvironmentProvider>
</Web3Provider>
</LanguageProvider>
</HashRouter>
</QueryClientProvider>
</FeatureFlagsProvider>
</Provider>
</StrictMode>
)
if (process.env.REACT_APP_SERVICE_WORKER !== 'false') {
serviceWorkerRegistration.register()
}