File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import BattleRoom from '../rooms/BattleRoom';
14
14
import PmRoom from '../rooms/PmRoom' ;
15
15
import HtmlRoom from '../rooms/HtmlRoom' ;
16
16
import { useClientStore } from '@/client/client' ;
17
+ import { ErrorBoundary } from 'react-error-boundary' ;
17
18
18
19
export default function BigPanel ( props : Readonly < HTMLAttributes < 'div' > > ) {
19
20
const room = useClientStore ( state => state . currentRoom ) ;
@@ -60,8 +61,12 @@ export default function BigPanel(props: Readonly<HTMLAttributes<'div'>>) {
60
61
>
61
62
< div className = { 'dark:bg-gray-300 flex flex-col w-full max-w-full' } >
62
63
< div className = "flex-grow flex-shrink min-h-0" >
63
- < Chat
64
- />
64
+ < ErrorBoundary fallbackRender = { ( { error : e } ) => {
65
+ console . error ( e ) ;
66
+ return < div className = "text-red-400" > Error displaying messages</ div > ;
67
+ } } >
68
+ < Chat />
69
+ </ ErrorBoundary >
65
70
</ div >
66
71
< div className = "flex-grow" >
67
72
< ChatBox className = 'p-2' />
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export default function Chat(props: Readonly<HTMLAttributes<HTMLDivElement>>) {
57
57
) }
58
58
ref = { ref }
59
59
>
60
- { messages [ currentRoom . ID ] ? messages [ currentRoom . ID ] . map ( ( message , index , arr ) => (
60
+ { messages [ currentRoom . ID ] ? messages [ currentRoom . ID + 1 ] . map ( ( message , index , arr ) => (
61
61
< ErrorBoundary
62
62
key = { index }
63
63
fallbackRender = { ( { error : e } ) => {
@@ -85,7 +85,6 @@ export default function Chat(props: Readonly<HTMLAttributes<HTMLDivElement>>) {
85
85
>
86
86
</ div >
87
87
</ div >
88
- { ' ' }
89
88
</ div >
90
89
) ;
91
90
}
You can’t perform that action at this time.
0 commit comments