2
2
3
3
import { QueryClient , QueryClientProvider } from '@tanstack/react-query'
4
4
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
5
- import * as Ably from 'ably'
6
- import { AblyProvider , ChannelProvider } from 'ably/react '
5
+ import { ChannelProvider } from 'ably/react '
6
+ import dynamic from 'next/dynamic '
7
7
import { Session } from 'next-auth'
8
8
import { SessionProvider } from 'next-auth/react'
9
9
import PlausibleProvider from 'next-plausible'
10
10
import { ThemeProvider } from 'next-themes'
11
11
import * as React from 'react'
12
12
13
- import { env } from '@/env.mjs'
13
+ const RealtimeProvider = dynamic ( ( ) => import ( './components/realtime' ) , {
14
+ ssr : false ,
15
+ } )
14
16
15
17
export interface ProvidersProps {
16
18
children : React . ReactNode
17
19
session : Session | null
18
20
}
19
21
20
22
const queryClient = new QueryClient ( )
21
- const ablyClient = new Ably . Realtime ( {
22
- authUrl : env . NEXT_PUBLIC_ABLY_BASE_URL + '/api/ably' ,
23
- authMethod : 'POST' ,
24
- } )
25
23
26
24
export function Providers ( { children, session } : ProvidersProps ) {
27
25
return (
@@ -36,11 +34,11 @@ export function Providers({ children, session }: ProvidersProps) {
36
34
enableSystem = { true }
37
35
>
38
36
< QueryClientProvider client = { queryClient } >
39
- < AblyProvider client = { ablyClient } >
37
+ < RealtimeProvider >
40
38
< ChannelProvider channelName = 'retrospective' >
41
39
{ children }
42
40
</ ChannelProvider >
43
- </ AblyProvider >
41
+ </ RealtimeProvider >
44
42
< ReactQueryDevtools initialIsOpen = { false } />
45
43
</ QueryClientProvider >
46
44
</ ThemeProvider >
0 commit comments