react-query#ReactQueryCacheProvider JavaScript Examples

The following examples show how to use react-query#ReactQueryCacheProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: useAccountQuery.test.js    From v3-ui with MIT License 6 votes vote down vote up
describe('useAccountQuery', () => {
  // Currently using AuthControllerContext in hook requires a lot more boilerplate
  xit('santizes the address', async () => {
    const queryCache = new QueryCache()

    // const contextValues = { chainId: 1 }

    const wrapper = ({ children }) => (
      <ReactQueryCacheProvider queryCache={queryCache}>{children}</ReactQueryCacheProvider>
    )

    const expectation = nock('https://api.thegraph.com')
      .get('/subgraphs/name/pooltogether/pooltogether-v3_1_0')
      .reply(200, {
        answer: 42
      })

    const { result, waitFor } = renderHook(() => useAccountQuery(), { wrapper })

    await waitFor(() => {
      return result.current.isSuccess
    })

    expect(result.current).toEqual({ answer: 42 })
  })
})
Example #2
Source File: _app.jsx    From pooltogether-landing-site with MIT License 5 votes vote down vote up
function MyApp({ Component, pageProps, router }) {
  // const [initialized, setInitialized] = useState(false)

  useEffect(() => {
    const handleExitComplete = () => {
      if (typeof window !== 'undefined') {
        window.scrollTo({ top: 0 })
      }
    }

    router.events.on('routeChangeComplete', handleExitComplete)
    return () => {
      router.events.off('routeChangeComplete', handleExitComplete)
    }
  }, [])

  useEffect(() => {
    const fathomSiteId = process.env.NEXT_JS_FATHOM_SITE_ID

    if (fathomSiteId) {
      Fathom.load(process.env.NEXT_JS_FATHOM_SITE_ID, {
        url: 'https://goose.pooltogether.com/script.js',
        includedDomains: [
          'pooltogether.com',
          'www.pooltogether.com',
        ]
      })

      function onRouteChangeComplete(url) {
        if (window['fathom']) {
          window['fathom'].trackPageview()
        }
      }

      router.events.on('routeChangeComplete', onRouteChangeComplete)

      return () => {
        router.events.off('routeChangeComplete', onRouteChangeComplete)
      }
    }
  }, [])

  // useEffect(() => {
  //   const initi18next = async () => {
  //     await i18next.initPromise.then(() => {
  //       setInitialized(true)
  //     })
  //   }
  //   initi18next()
  // }, [])

  return <>
    <ReactQueryCacheProvider queryCache={queryCache}>
      <AllContextProviders>
        <Layout
          props={pageProps}
        >
          <Component {...pageProps} />
        </Layout>
      </AllContextProviders>
        
      <ReactQueryDevtools />
    </ReactQueryCacheProvider>

    <ToastContainer
      className='pool-toast'
      position='top-center'
      autoClose={7000}
    />
  </>
}