Loading frontend/src/components/Noticeboard/index.tsx +5 −13 Original line number Diff line number Diff line import { Button, Section } from '@blueprintjs/core' import { useState } from 'react' import { NoticeboardMessagesQuery, useTypedQuery } from '@inject/graphql' import { useNoticeboardSubscription } from '@inject/graphql' import { NoticeboardCommentDialog } from './CommentDialog' import { NoticeboardMessagesList } from './MessagesList' export const Noticeboard = () => { const [addDialogOpened, setAddDialogOpened] = useState(false) const [{ fetching, data: noticebordMessagesQuery }] = useTypedQuery({ query: NoticeboardMessagesQuery, }) const [{ data, fetching }] = useNoticeboardSubscription() const messages = data?.noticeboardMessages ?? [] return ( <> Loading @@ -21,11 +20,7 @@ export const Noticeboard = () => { /> <Section title={`Noticeboard${ noticebordMessagesQuery?.noticeboardMessages ? ` (${noticebordMessagesQuery.noticeboardMessages.length})` : '' }`} title={`Noticeboard${messages.length ? ` (${messages.length})` : ''}`} rightElement={ <Button onClick={e => { Loading @@ -39,10 +34,7 @@ export const Noticeboard = () => { } collapsible > <NoticeboardMessagesList loading={fetching} messages={noticebordMessagesQuery?.noticeboardMessages ?? []} /> <NoticeboardMessagesList loading={fetching} messages={messages} /> </Section> </> ) Loading graphql/graphql-cache.d.ts +2 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes graphql/index.ts +1 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,5 @@ export { useChannelTypeEnabled } from './utils/useChannelTypeEnabled' export { useLoopStatus } from './utils/useExerciseLoopStatusSubscription' export { useExercisesSubscription } from './utils/useExercisesSubscription' export { useGetEmailThreadUnreadCountSuspense } from './utils/useGetEmailThreadUnreadCountSuspense' export { useNoticeboardSubscription } from './utils/useNoticeboardSubscription' export { useUploadFiles } from './utils/useUploadFile' graphql/subscriptions.ts +14 −0 Original line number Diff line number Diff line Loading @@ -79,3 +79,17 @@ export const InstructorCommentsSubscription = graphql( `, [Fragments.InstructorComment] ) export const NoticeboardSubscription = graphql( ` subscription NoticeboardSubscription { noticeboardSubscription { message { ...NoticeboardMessage } eventType } } `, [Fragments.NoticeboardMessage] ) graphql/urql/subschemas/remoteSchema.ts +2 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,8 @@ const constructRemoteSchema = (): SubschemaConfig => { ws.current.status === WebSocket.CLOSED || ws.current.status === WebSocket.CLOSING ) { // TODO: fix "Websocket is closed before the connection is established" // ws.current.status === WebSocket.OPEN if (ws.current !== null) { ws.current.close(true, false) ws.current = null Loading Loading
frontend/src/components/Noticeboard/index.tsx +5 −13 Original line number Diff line number Diff line import { Button, Section } from '@blueprintjs/core' import { useState } from 'react' import { NoticeboardMessagesQuery, useTypedQuery } from '@inject/graphql' import { useNoticeboardSubscription } from '@inject/graphql' import { NoticeboardCommentDialog } from './CommentDialog' import { NoticeboardMessagesList } from './MessagesList' export const Noticeboard = () => { const [addDialogOpened, setAddDialogOpened] = useState(false) const [{ fetching, data: noticebordMessagesQuery }] = useTypedQuery({ query: NoticeboardMessagesQuery, }) const [{ data, fetching }] = useNoticeboardSubscription() const messages = data?.noticeboardMessages ?? [] return ( <> Loading @@ -21,11 +20,7 @@ export const Noticeboard = () => { /> <Section title={`Noticeboard${ noticebordMessagesQuery?.noticeboardMessages ? ` (${noticebordMessagesQuery.noticeboardMessages.length})` : '' }`} title={`Noticeboard${messages.length ? ` (${messages.length})` : ''}`} rightElement={ <Button onClick={e => { Loading @@ -39,10 +34,7 @@ export const Noticeboard = () => { } collapsible > <NoticeboardMessagesList loading={fetching} messages={noticebordMessagesQuery?.noticeboardMessages ?? []} /> <NoticeboardMessagesList loading={fetching} messages={messages} /> </Section> </> ) Loading
graphql/graphql-cache.d.ts +2 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes
graphql/index.ts +1 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,5 @@ export { useChannelTypeEnabled } from './utils/useChannelTypeEnabled' export { useLoopStatus } from './utils/useExerciseLoopStatusSubscription' export { useExercisesSubscription } from './utils/useExercisesSubscription' export { useGetEmailThreadUnreadCountSuspense } from './utils/useGetEmailThreadUnreadCountSuspense' export { useNoticeboardSubscription } from './utils/useNoticeboardSubscription' export { useUploadFiles } from './utils/useUploadFile'
graphql/subscriptions.ts +14 −0 Original line number Diff line number Diff line Loading @@ -79,3 +79,17 @@ export const InstructorCommentsSubscription = graphql( `, [Fragments.InstructorComment] ) export const NoticeboardSubscription = graphql( ` subscription NoticeboardSubscription { noticeboardSubscription { message { ...NoticeboardMessage } eventType } } `, [Fragments.NoticeboardMessage] )
graphql/urql/subschemas/remoteSchema.ts +2 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,8 @@ const constructRemoteSchema = (): SubschemaConfig => { ws.current.status === WebSocket.CLOSED || ws.current.status === WebSocket.CLOSING ) { // TODO: fix "Websocket is closed before the connection is established" // ws.current.status === WebSocket.OPEN if (ws.current !== null) { ws.current.close(true, false) ws.current = null Loading